# Sonarr

**🟢 Media Service**

## Service Overview

| Property | Value |
|----------|-------|
| **Service Name** | sonarr |
| **Host** | Atlantis (Synology) |
| **Category** | Media / TV |
| **Docker Image** | `lscr.io/linuxserver/sonarr:latest` |
| **Compose File** | `hosts/synology/atlantis/arr-suite/docker-compose.yml` |
| **URL** | http://192.168.0.200:8989 |

## Purpose

Sonarr is an automated TV series download manager. It monitors RSS feeds and indexers for new
episodes, grabs them via SABnzbd (Usenet) or Deluge (torrent), and organises the files into your
media library. It integrates with Prowlarr for indexer management and Bazarr for subtitles.

## API Access

| Field | Value |
|-------|-------|
| **URL** | http://192.168.0.200:8989 |
| **API Key** | `REDACTED_SONARR_API_KEY` |
| **Header** | `X-Api-Key: "REDACTED_API_KEY"` |

```bash
SONARR="http://192.168.0.200:8989"
SONARR_KEY="REDACTED_SONARR_API_KEY"

# System status
curl -s "$SONARR/api/v3/system/status" -H "X-Api-Key: $SONARR_KEY" | python3 -m json.tool

# Delay profiles (NZB-first config)
curl -s "$SONARR/api/v3/delayprofile" -H "X-Api-Key: $SONARR_KEY" | python3 -m json.tool

# Download clients
curl -s "$SONARR/api/v3/downloadclient" -H "X-Api-Key: $SONARR_KEY" | python3 -m json.tool

# Queue (active downloads)
curl -s "$SONARR/api/v3/queue" -H "X-Api-Key: $SONARR_KEY" | python3 -m json.tool

# Wanted / missing episodes
curl -s "$SONARR/api/v3/wanted/missing" -H "X-Api-Key: $SONARR_KEY" | python3 -m json.tool
```

## Configuration

### Docker Compose (in docker-compose.yml)

```yaml
sonarr:
  image: lscr.io/linuxserver/sonarr:latest
  container_name: sonarr
  environment:
    - PUID=1029
    - PGID=100
    - TZ=America/Los_Angeles
    - UMASK=022
    - DOCKER_MODS=ghcr.io/themepark-dev/theme.park:sonarr
    - TP_SCHEME=http
    - TP_DOMAIN=192.168.0.200:8580
    - TP_THEME=dracula
  volumes:
    - /volume2/metadata/docker2/sonarr:/config
    - /volume1/data:/data
    - /volume3/usenet:/sab
  ports:
    - "8989:8989"
  networks:
    media2_net:
      ipv4_address: 172.24.0.7
  security_opt:
    - no-new-privileges:true
  restart: always
```

Config on Atlantis: `/volume2/metadata/docker2/sonarr/`

### Download Priority

Sonarr uses an NZB-first / torrent-fallback strategy:

| Setting | Value |
|---------|-------|
| Preferred protocol | Usenet |
| Usenet delay | 0 min |
| Torrent delay | 120 min |
| Bypass if highest quality | false |
| SABnzbd priority | 1 (highest) |
| Deluge priority | 50 (fallback) |

See `docs/services/individual/download-priority.md` for full details.

## Connected Services

| Service | Role |
|---------|------|
| SABnzbd | Primary download client (Usenet) |
| Deluge | Fallback download client (torrent, via gluetun VPN) |
| Prowlarr | Indexer management |
| Bazarr | Subtitle automation |

## Troubleshooting

**Episode grabbed but not imported**
- Check queue: `curl -s "$SONARR/api/v3/queue" -H "X-Api-Key: $SONARR_KEY"`
- Verify `/volume1/data` mount and permissions

**SABnzbd not receiving jobs**
- Check download clients: Settings → Download Clients → SABnzbd → Test
- Confirm SABnzbd is running: `docker ps | grep sabnzbd`

**Torrent grabbed before 2-hour wait**
- Verify delay profile: `bypassIfHighestQuality` must be `false`
- See `docs/services/individual/download-priority.md`

## Related Services

- Radarr — http://192.168.0.200:7878
- Bazarr — http://192.168.0.200:6767
- Prowlarr — http://192.168.0.200:9696
- SABnzbd — http://192.168.0.200:8080
