Go service that prefetches upcoming Sonarr seasons from active Jellyfin playback.
  • Go 99.4%
  • Dockerfile 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
renovate[bot] fa0132fc4c
fix(deps): update module github.com/sj14/jellyfin-go to v0.4.4 (#16)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-15 21:44:32 +02:00
.github/workflows ci(deps): update goreleaser/goreleaser-action action to v7 (#7) 2026-05-21 21:11:50 +02:00
assets clear 2026-05-19 21:29:18 +02:00
cmd/prefetcharr feat: initial commit 2026-05-19 20:57:12 +02:00
internal/app fix: add title key 2026-06-15 21:40:33 +02:00
.gitignore feat: initial commit 2026-05-19 20:57:12 +02:00
.golangci.yml feat: initial commit 2026-05-19 20:57:12 +02:00
.goreleaser.dev.yml chore: update goreleaser dev 2026-05-19 22:22:28 +02:00
.goreleaser.yml chore: cleanup goreleaser config 2026-05-25 21:18:19 +02:00
AGENTS.md docs: update readme 2026-05-21 19:55:00 +02:00
config.example.yaml feat: add shoutrrr notifications 2026-05-26 19:45:45 +02:00
Dockerfile fix: update dockerfile command 2026-05-19 22:36:13 +02:00
go.mod fix(deps): update module github.com/sj14/jellyfin-go to v0.4.4 (#16) 2026-06-15 21:44:32 +02:00
go.sum fix(deps): update module github.com/sj14/jellyfin-go to v0.4.4 (#16) 2026-06-15 21:44:32 +02:00
LICENSE chore: add license 2026-05-19 22:41:23 +02:00
README.md feat: add shoutrrr notifications 2026-05-26 19:45:45 +02:00
renovate.json chore(renovate): disable limit 2026-05-21 21:10:05 +02:00

prefetcharr-go

prefetcharr-go watches active Jellyfin TV sessions and asks Sonarr to search upcoming seasons at the right moment, so the next season is ready before the viewer gets there.

Release golangci-lint

Behavior

On each poll, prefetcharr-go reads active Jellyfin sessions, ignores anything that is not an episode, resolves the parent series TVDB ID, finds that series in Sonarr, and searches configured future seasons.

With seasons_ahead: 1, min_season_progress_percent: 0, and include_current_season: false, watching S01E01 searches season 2. Set seasons_ahead: 2 to search seasons 2 and 3.

Set min_season_progress_percent to wait until later in the current season before prefetching. For example, with a 10 episode season, min_season_progress_percent: 30 means episodes 1 and 2 do not trigger prefetching, while episode 3 and later do.

Already searched seasons are deduplicated for 7 days to avoid submitting the same Sonarr search every poll.

⚙️ Configuration

Copy config.example.yaml and fill in the API keys:

interval: 300s
log_level: debug

prefetch:
  seasons_ahead: 1
  min_season_progress_percent: 0
  include_current_season: false
  search_complete_seasons: false

notifications:
  enabled: false
  urls: []
  events:
    - search_submitted

jellyfin:
  url: http://jellyfin:8096
  api_key: your-jellyfin-api-key

sonarr:
  url: http://sonarr:8989
  api_key: your-sonarr-api-key

allowed_users: []

Notifications use shoutrrr URLs, so the same config can target Discord, Gotify, ntfy, Slack, SMTP, webhooks, and other supported services. Notification delivery is best-effort: failures are logged with notification URLs redacted and do not stop polling or searching.

notifications:
  enabled: true
  urls:
    - ntfy://ntfy.sh/prefetcharr-alerts
  events:
    - search_submitted

Supported events are:

  • search_submitted: a Sonarr season search command was submitted.

🐳 Docker Compose

Create ./prefetcharr-go/config.yaml from config.example.yaml, then run prefetcharr-go with Docker Compose:

services:
  prefetcharr:
    image: ghcr.io/primexz/prefetcharr-go:latest
    container_name: prefetcharr-go
    networks:
      - arr
    volumes:
      - ./prefetcharr:/config:ro
    restart: always

The container expects the configuration file at /config/config.yaml, so with the volume above your local config must be placed at:

./prefetcharr/config.yaml

Start the container with:

docker compose up -d

💻 Run

go run ./cmd/prefetcharr -config config.yaml

🛠 Build

go build -o prefetcharr-go ./cmd/prefetcharr