# Lidarr / Deezer Monitoring Guide

Quick reference for checking what arr-scripts is doing and managing downloads.

## How it works

The `Audio` service runs continuously inside the Lidarr container. Every cycle it:
1. Asks Lidarr for missing albums
2. Searches Deezer for each one using fuzzy title matching
3. Downloads matches via deemix (320kbps MP3)
4. Notifies Lidarr to import the files

You do nothing — it runs in the background forever.

---

## Watching it live

**Via Portainer** (easiest):
Portainer → Containers → `lidarr` → Logs → enable Auto-refresh

**Via SSH:**
```bash
ssh atlantis
DOCKER=/var/packages/REDACTED_APP_PASSWORD/target/usr/bin/docker
sudo $DOCKER logs lidarr -f
```

**Reading the log lines:**
```
1 :: missing :: 47 of 984 :: Emis Killa :: 17 :: Getting Album info...
                 ^^^^^^^^^^                        → searching Deezer

:: Deezer MATCH Found :: Calculated Difference = 0
                                                   → found it, downloading next

[album_123] Emis Killa - GOAT :: Track downloaded.
                                                   → deemix downloading track by track

LIDARR IMPORT NOTIFICATION SENT! :: /config/extended/import/Emis Killa-17 (2021)
                                                   → done, Lidarr importing it
```

**Check current position (without tailing):**
```bash
ssh atlantis "DOCKER=/var/packages/REDACTED_APP_PASSWORD/target/usr/bin/docker && sudo \$DOCKER exec lidarr sh -c 'ls -t /config/logs/Audio-*.txt | head -1 | xargs tail -5'"
```

---

## Checking if an album downloaded

Go to **Lidarr UI** → `http://192.168.0.200:8686` → search the artist → the album should show track files filled in (green) instead of missing (red/grey).

Or via API:
```bash
# Get track file count for an artist by name
curl -s 'http://192.168.0.200:8686/api/v1/artist?apikey=REDACTED_API_KEY | \
  python3 -c "
import sys, json
artists = json.load(sys.stdin)
for a in artists:
    if 'emis' in a.get('artistName','').lower():
        s = a.get('statistics', {})
        print(a['artistName'], '-', s.get('trackFileCount',0), '/', s.get('totalTrackCount',0), 'tracks')
"
```

---

## Pausing and resuming downloads

**Quick pause (until next restart):**
```bash
# Via Portainer → Containers → lidarr → Console → Connect
s6-svc -d /run/service/custom-svc-Audio

# Resume
s6-svc -u /run/service/custom-svc-Audio
```

**Permanent pause (survives restarts):**
1. Edit `/volume2/metadata/docker2/lidarr/extended.conf` on Atlantis
2. Set `enableAudio="false"`
3. Restart the lidarr container

---

## Checking where it is in the queue

The queue is sorted newest-release-date first. To find where a specific artist sits:

```bash
curl -s 'http://192.168.0.200:8686/api/v1/wanted/missing?page=1&pagesize=1000&sortKey=releaseDate&sortDirection=descending&apikey=REDACTED_API_KEY | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for i, r in enumerate(data.get('records', [])):
    artist = r.get('artist', {}).get('artistName', '')
    if 'emis' in artist.lower():  # change this filter
        print(f'pos {i+1}: {r[\"releaseDate\"][:10]} | {artist} - {r[\"title\"]}')
"
```

---

## Checking if the ARL token is still valid

The ARL token expires roughly every 3 months. Signs it's expired: downloads silently fail or deemix returns 0 tracks.

**Check ARLChecker log:**
```bash
ssh atlantis "DOCKER=/var/packages/REDACTED_APP_PASSWORD/target/usr/bin/docker && sudo \$DOCKER exec lidarr sh -c 'ls -t /config/logs/ARLChecker-*.txt | head -1 | xargs cat'"
```

**Renew the token:**
1. Log in to deezer.com in a browser
2. Open DevTools (F12) → Application tab → Cookies → `deezer.com` → find the `arl` cookie → copy the value
3. On Atlantis, edit `/volume2/metadata/docker2/lidarr/extended.conf`
4. Update the `arlToken="..."` line
5. Restart the container: Portainer → Containers → `lidarr` → Restart

---

## Service health check

```bash
# Are all arr-scripts services running?
# Via Portainer console exec into lidarr:
s6-svstat /run/service/custom-svc-Audio
s6-svstat /run/service/custom-svc-ARLChecker
s6-svstat /run/service/custom-svc-QueueCleaner
s6-svstat /run/service/custom-svc-AutoConfig

# Per-service log files
ls /config/logs/
```

---

## What the log errors mean

| Error | Meaning | Action |
|-------|---------|--------|
| `is not ready, sleeping until valid response...` | Scripts can't reach Lidarr API — usually from a stale start | Restart container |
| `ERROR :: download failed, missing tracks...` | deemix returned 0 files — ARL token expired or album unavailable in region | Renew ARL token |
| `ERROR :: Unable to match using beets...` | Beets couldn't tag against MusicBrainz | Non-critical, import still proceeds |
| `ERROR :: No results found via Fuzzy Search...` | Album not on Deezer | Nothing to do, script moves on |
| `Calculated Difference () greater than 3` | pyxdameraulevenshtein broken | See [common-issues.md](../troubleshooting/common-issues.md#arr-scripts-lidarr-deezer) |
