# Lidarr

Music collection manager with Deezer integration via arr-scripts.

## Service Info

| Property | Value |
|----------|-------|
| **Host** | Atlantis (192.168.0.200) |
| **URL** | http://192.168.0.200:8686 |
| **Compose file** | `hosts/synology/atlantis/arr-suite/docker-compose.yml` |
| **Config volume** | `/volume2/metadata/docker2/lidarr` |
| **Portainer stack** | arr-stack (stack ID 560, env 2) |
| **API key** | `2084f02ddc5b42d5afe7989a2cf248ba` |

## arr-scripts / Deezer Integration

Lidarr uses [arr-scripts by RandomNinjaAtk](https://github.com/RandomNinjaAtk/arr-scripts) to download music from Deezer via deemix. This is the primary download source since usenet indexers have zero coverage for non-English music (Italian, Japanese, etc.).

### How it works

1. arr-scripts runs as s6 services inside the Lidarr container
2. The `Audio` service polls Lidarr's missing albums queue every cycle
3. For each missing album, it searches Deezer using fuzzy title matching (Damerau-Levenshtein distance)
4. On match, it calls `deemix` to download at 320kbps MP3 (Deezer Premium)
5. Files are placed in `/config/extended/import/` and Lidarr is notified via API to import them

### File locations on Atlantis

| Path | Purpose |
|------|---------|
| `/volume2/metadata/docker2/lidarr/extended.conf` | arr-scripts config — **not in git** (contains ARL token) |
| `/volume2/metadata/docker2/lidarr-scripts/custom-cont-init.d/scripts_init.bash` | Init script that runs on every container start |
| `/volume2/metadata/docker2/lidarr-scripts/custom-services.d/` | s6 service definitions (populated automatically on first start) |

### extended.conf key settings

```bash
enableAutoConfig="true"      # Required sentinel — all services check this first
enableAudio="true"           # Set to "false" to pause downloads
dlClientSource="deezer"
audioFormat="native"
audioBitrate="high"          # "high" = 320kbps MP3 with native format (NOT a number)
arlToken="..."               # Deezer session cookie — expires ~3 months, not in git
enableBeetsTagging="true"
beetsMatchPercentage="90"
enableReplaygainTags="true"
```

> **ARL token**: Get from deezer.com → DevTools → Application → Cookies → `arl`. Requires Deezer Premium.

### Pausing/resuming downloads

**Quick (via Portainer console exec into `lidarr`):**
```sh
s6-svc -d /run/service/custom-svc-Audio   # pause
s6-svc -u /run/service/custom-svc-Audio   # resume
```

**Persistent (survives restarts):**
Edit `/volume2/metadata/docker2/lidarr/extended.conf`, set `enableAudio="false"`, restart container.

### scripts_init.bash — why it exists

`setup.bash` (downloaded from GitHub) silently fails to install several Python packages on Alpine due to setuptools build errors. `scripts_init.bash` re-installs them explicitly after `setup.bash` runs:

- `yq` — Python yq whose `xq` binary replaces Alpine's `xq` (v1.x outputs XML passthrough instead of JSON)
- `pyxdameraulevenshtein` — Damerau-Levenshtein distance for fuzzy album title matching
- `deemix` — actual Deezer downloader
- `colorama`, `pylast`, `mutagen`, `langdetect`, `apprise`, `r128gain` — supporting packages

Without these, downloads fail silently or the scripts get stuck in a "not ready" loop forever.

## Compose volumes

```yaml
volumes:
  - /volume2/metadata/docker2/lidarr:/config
  - /volume1/data:/data
  - /volume3/usenet:/sab
  - /volume2/metadata/docker2/lidarr-scripts/custom-services.d:/custom-services.d
  - /volume2/metadata/docker2/lidarr-scripts/custom-cont-init.d:/custom-cont-init.d
```

## Indexers

Usenet indexers (NZBgeek, NzbPlanet, etc.) have near-zero coverage for non-English music. Deezer via arr-scripts is the primary source. Usenet indexers still handle English/mainstream releases when they appear.

## Troubleshooting

See [arr-scripts troubleshooting](../../troubleshooting/common-issues.md#arr-scripts-lidarr-deezer) for the full list of known issues and fixes.
