Let Sonarr fetch the next season of a show you are watching on Jellyfin/Emby/Plex.
prefetcharr periodically polls your media server for active playback sessions.
For TV shows, it checks whether the pilot is playing or if the end of a season
is almost reached.
If this is the case and the next/first season has not been downloaded yet,
prefetcharr asks Sonarr to monitor it and initiate a season search. If there
are no more seasons left, the series gets monitored for new seasons instead.
To install, first ensure Rust is installed on your system by following the instructions at Install Rust, then run:
cargo install --git https://github.com/p-hueber/prefetcharr
Or with docker compose:
services:
prefetcharr:
image: phueber/prefetcharr:latest
container_name: prefetcharr
environment:
# `jellyfin`, `emby` or `plex`
- MEDIA_SERVER_TYPE=jellyfin
# Jellyfin/Emby/Plex baseurl
- MEDIA_SERVER_URL=http://example.com/jellyfin
# Jellyfin/Emby API key or plex server token
- MEDIA_SERVER_API_KEY=<YOUR KEY HERE>
# Sonarr baseurl
- SONARR_URL=http://example.com/sonarr
# Sonarr API key
- SONARR_API_KEY=<YOUR KEY HERE>
# Logging directory
- LOG_DIR=/log
# Log level
- RUST_LOG=prefetcharr=debug
# Polling interval in seconds
- INTERVAL=900
# The last <NUM> episodes trigger a search
- REMAINING_EPISODES=2
# Optional: Only monitor sessions for specific user IDs or names
# - USERS=john,12345,alex
volumes:
- /path/to/log/dir:/log
prefetcharr needs two different API keys to do its job.
Go to Settings
-> General
-> Security
and copy the API key.
The key to use and how to obtain it differs on the type of media server you use:
Log in as an administrator and go to Administration
-> Dashboard
->
Advanced
-> Api Keys
. Add a new key or use an existing one.
Log in as an administrator, click on the gear on the top right and go to
Advanced
-> Api Keys
. Add a new key or use an existing one.
You need to extract the server token from a configuration file and use it as the API key.
If you want to store pilot episodes only, prefetcharr can fetch the first
season for you on demand.
This method works well for individual episodes but may encounter issues with
season packs.
For this to function in Sonarr, grabbing the season pack must be considered
an upgrade of the pilot episode.
This can be achieved through a custom format.
Import
the custom format and configure a quality profile
to prefer it.
If you installed prefetcharr through cargo
, you can get a description of the
command-line interface by running prefetcharr --help
.
Users utilizing Docker only need to start the container, e.g. using docker compose up -d prefetcharr
.
Once the container is running, you may want to check the logs for errors. You
can do so by either calling docker logs prefetcharr
or by checking the logging
directory you configured.
- Disable Docker in Unraid.
- Upload my-prefetcharr.xml
to the following directory:
/boot/config/plugins/dockerMan/templates-user
. - Once the file is uploaded, re-enable Docker.
- To add the Docker image, go to Docker > Add Container.
- Select Template > User Templates > then choose prefetcharr.