# Plex 1.43.2 Loudness Analysis Debug — Full Investigation

Session: June 27, 2026. Server: Ubuntu 26.04, Plex 1.43.2.10687-563d026ea, Docker.

## Investigation Chain

### 1. Initial complaint: DJ Friendgänger greyed out
User's Albanian Traditional Music library (section 4, 170 tracks) had sonic analysis enabled and completed per Plex UI, but DJ Friendgänger was greyed out.

### 2. Server-level diagnostic
```python
# GET /:/prefs revealed:
MusicAnalysisBehavior: scheduled     # ✅ correct
LoudnessAnalysisBehavior: asap       # ❌ blocking loudness analysis
ButlerStartHour: 18
ButlerEndHour: 20
```

**Fix applied:** Set `LoudnessAnalysisBehavior=scheduled`.

### 3. Database check — loudness data
```sql
SELECT COUNT(*) FROM media_parts mp
JOIN media_items mi ON mi.id = mp.media_item_id
WHERE mi.library_section_id = 4
AND mp.extra_data LIKE '%"ma:loudness"%'
-- Result: 0 of 170 tracks
```

### 4. Activity history — ZERO-WORK pattern
```sql
SELECT title, subtitle, started_at, finished_at
FROM activities WHERE title LIKE '%loudness%' ORDER BY started_at DESC
-- Result: 5 entries, all 'Butler tasks: LoudnessAnalysis', ALL ZERO-WORK
```

### 5. Attempted trigger: butler hours + musicAnalysis toggle
Set butler to current hour. Toggled musicAnalysis off/on. Butler ran but only processed "Processing 1 albums" — the one album was from section 5 (Club Hits), not section 4.

### 6. Attempted CLI: `--analyze-loudness`
```bash
docker exec plex "Plex Media Scanner" --analyze-loudness --section 4 --loudness-parallelism 8
# Result: exit 0, no output, no log file created, no loudness data
docker exec plex "Plex Media Scanner" --analyze-loudness 4 --loudness-parallelism 8
# Result: exit 0, no output, no log file created, no loudness data
docker exec plex "Plex Media Scanner" --analyze-loudness --item 18017
# Result: exit 0, no output, no loudness data
```

### 7. Attempted CLI: `--analyze-deeply`
```bash
docker exec plex "Plex Media Scanner" --analyze-deeply --section 4
# Result: exit 0, no output, no log
docker exec plex "Plex Media Scanner" --analyze-deeply 4
# Result: exit 0, no output, no log
```

### 8. Attempted: HTTP API
```python
PUT /library/sections/4/analyze  # 200, no effect
PUT /library/metadata/{id}/analyze  # 200 per item, no effect
```

### 9. Persistence check — found indexes ARE present
```bash
ls "Databases/Music Analysis 4/"
# Album.tree (121K), Artist.tree (82K), Mapping.db (44K), Track.tree (130K)
```
This proved sonic fingerprinting had completed successfully. The "persistence bug" in earlier docs was wrong — indexes ARE persisted, just in binary tree files, not as `sa:` keys.

### 10. Found gate: `pv:deepAnalysisDate`
All 170 tracks in section 4 had `pv:deepAnalysisDate: 1781974855` (June 20, 2026) in `media_parts.extra_data`. This timestamp tells Plex "already analyzed."

### 11. Cleared `pv:deepAnalysisDate` from all 170 tracks
```python
# Removed pv:deepAnalysisDate from extra_data via regex replacement
# 170 tracks updated
```

### 12. Restart + butler trigger
```bash
docker compose restart plex
# Set butler hours to current
# Toggled musicAnalysis off → on for section 4
```

### 13. Butler picked up items
`/activities` showed: "Sonic Analysis: Processing 5 albums" at 0%
`ps aux` showed: `Plex Media Scanner --analyze-deeply --item 25040`

### 14. Scanner confirmed running on section 4 item
Item 25040: "Po e mirë oj nane / Nisja tash me def / Hajde me shuplakë - Live" (section 4)
Deep Analysis log showed: "Read 10000 packets at 261.198367", "Read 20000 packets at 522.422857"

### 15. But NO loudness data produced
After scanner completed:
- `pv:deepAnalysisDate` updated to new timestamp (1782165677)
- `ma:loudness`, `ma:gain`, `ma:peak`, `ma:lra` still MISSING
- Loudness count: 0/170

## Root Cause Confirmed

On Plex 1.43.2:
- `--analyze-deeply` runs, reads files, updates `deepAnalysisDate` — but does NOT compute EBU R128 loudness
- `--analyze-loudness` is completely non-functional (exit 0, zero effect) 
- The butler only triggers `--analyze-deeply`, never `--analyze-loudness`
- There is no mechanism to trigger loudness analysis on 1.43.2

## Key Database State Signals

| Condition | SQL Check | Meaning |
|-----------|-----------|---------|
| Loudness missing | `extra_data NOT LIKE '%ma:loudness%'` | Phase 1 never ran |
| `deepAnalysisDate` present | `extra_data LIKE '%pv:deepAnalysisDate%'` | Butler skips this item |
| Sonic indexes exist | Check `Music Analysis {sid}/` dir | Phase 2 completed |
| ZERO-WORK activities | `started_at = finished_at` | Butler tried but found nothing to do |

## Summary

DJ Friendgänger can never work on Plex 1.43.2 because loudness analysis (EBU R128) cannot be triggered through any mechanism. The only fix is downgrading Plex.
