Table of Contents

iCal Calendar Sync Link

The proper link format is:

https://mydomain.com/SERVARR/feed/calendar/SERVARR.ics?apikey=API_KEY

where:

Periodic Search for Missing Items

Even though Servarr PVRs are not meant to perform backfill searches, the following short script can be scheduled with cron and will periodically connect to all the PVRs in order to trigger the "search missing" functionality.

#!/usr/bin/env bash
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2024 - License: GNU GPLv3      ##
###########################################################################
# This is a small script that can be used to automatically search for     #
# missing content for different PVR servers under the Servarr family.     #
###########################################################################
 
###########################################################################
##                            CONFIGURATION                              ##
###########################################################################
 
# Path to a lock file.
LOCK_FILE='/tmp/@rr-missing-state.lock'
 
# Turn on verbosity for debugging.
VERBOSE=0
 
# All SERVARR_* variables are configured sequentially where the fist URL
# within SERVARR_COMMAND_URL matches the first API key in SERVARR_API_KEY.
 
# {lidarr,radarr,readarr,sonarr,whisparr}.tld should be changed to the
# server name of the respective PVR.
SERVARR_COMMAND_URL=( 
    http://lidarr.tld/lidarr/api/v1/command 
    http://radarr.tld/radarr/api/v3/command 
    http://readarr.tld/readarr/api/v1/command 
    http://sonarr.tld/sonarr/api/v3/command 
    http://whisparr.tld/whisparr/api/v3/command
)
 
# The API Key for each PVR, in sequence must be added line-by-line to
# the following array definition.
SERVARR_API_KEY=( 
    60b725f10c9c85c70d97880dfe8191b3
    5d47bb807bf03f3248c00151c0b00382
    66b9b1109eb98010edf7f135565b0579
    a3db842660bf5d8d432db9d743629fec
    b04999d7fa5215eb7f103e99226baa7f
)
 
# This variable need not be changed unless the sequence changes.
SERVARR_NAME=(
    lidarr
    radarr
    readarr
    sonarr
    whisparr
)
 
# This variable need not be changed unless the sequence changes.
SERVARR_COMMAND_NAME=(
    MissingAlbumSearch
    MissingMoviesSearch
    MissingBookSearch
    MissingEpisodeSearch
    MissingEpisodeSearch
)
 
###########################################################################
##                              INTERNALS                                ##
###########################################################################
 
# Acquire a lock.
if mkdir $LOCK_FILE 2>&1 >/dev/null; then
    trap '{ rm -rf $LOCK_FILE; }' KILL QUIT TERM EXIT INT HUP
else
    exit 0
fi
 
for INDEX in "${!SERVARR_COMMAND_URL[@]}"; do
    SEARCH=$(curl -L -s -d "{ \"name\": \"${SERVARR_COMMAND_NAME[$INDEX]}\" }" -H "Content-Type: application/json" -X POST ${SERVARR_COMMAND_URL[$INDEX]}?apikey=${SERVARR_API_KEY[$INDEX]} | jq -r .status)
 
    [ $VERBOSE = 1 ] && case $SEARCH in
        "started")
            echo "Search for missing started on "${SERVARR_NAME[$INDEX]}
            ;;
        *)
            echo "Failed to search for missing content on "${SERVARR_NAME[$INDEX]}
            ;;
    esac
done

In order to use the script, change the variables in the INTERNALS section of the script accordingly and then schedule the script via cron to run periodically (on Debian, simply drop the script into /etc/cron.daily). Note that backfill searches might add a great amount of missing items to the queue as well as grab them and add the download to the download client such that it is recommended to run this script at most once per day. The script works well with the script meant to periodically remove stalled downloads from the PVRs.

Detecting Broken Files

A companion service can be used to check whether the downloaded media files are sane; one such service is checkrr that can be run under docker and is able to crawl media collections and then issue a redownload request to Sonarr, Radarr and Lidarr in order to download the media again.

"Failed to load queue"

Sometimes when accessing ActivityQueue, due to various reasons and bugs, the message "Failed to load queue" might be displayed. Typically what happens is that some release is stuck in the queue and gets corrupted such that the queue fails to be displayed.

The easiest fix, short of reporting the bug, is to shut down the Servarr (Sonarr, Radarr, Lidarr or Whisparr), to access the database and truncate the PendingReleases table.

For example, using the command-line SQLite client (and for the Radarr Servarr):

sqlite3 radarr.db

followed by:

DELETE FROM PendingReleases;

Restarting the Servarr should now fix the issue and allow the queue to be displayed correctly.