Upgrade search: only episodes below cutoff score + missing (instead of SeriesSearch for everything)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-02 16:31:40 +01:00
co-authored by Claude Opus 5.5
parent c8f4a399f3
commit b8adf0227f
+14 -4
View File
@@ -3,8 +3,10 @@ Scheduled upgrade search (upgradeSearch.schedule): makes Sonarr/Radarr actively
German / German DL instead of English-only files) for everything already in the library. German / German DL instead of English-only files) for everything already in the library.
RSS only sees new uploads, so older episodes would otherwise never be upgraded. RSS only sees new uploads, so older episodes would otherwise never be upgraded.
- Sonarr: SeriesSearch for every monitored series. Sonarr's "Cutoff Unmet" list only looks - Sonarr: EpisodeSearch only for monitored episodes whose file scores below the profile's
at quality, not at custom format scores, so CutoffUnmetEpisodeSearch would find nothing. cutoffFormatScore, plus MissingEpisodeSearch. Sonarr's "Cutoff Unmet" list only looks at
quality, not at custom format scores, so CutoffUnmetEpisodeSearch would find nothing; and a
SeriesSearch per series searches anime episode by episode (hundreds of indexer queries).
- Radarr: CutoffUnmetMoviesSearch (Radarr does consider CF scores) + MissingMoviesSearch. - Radarr: CutoffUnmetMoviesSearch (Radarr does consider CF scores) + MissingMoviesSearch.
The API keys are read at runtime from the apps' config PVCs (mounted read-only), so they The API keys are read at runtime from the apps' config PVCs (mounted read-only), so they
@@ -48,9 +50,17 @@ spec:
cmd() { curl -sf -H "X-Api-Key: $2" -H "Content-Type: application/json" -X POST "$1/api/v3/command" -d "$3" | jq -r '"\(.name): \(.status)"'; } cmd() { curl -sf -H "X-Api-Key: $2" -H "Content-Type: application/json" -X POST "$1/api/v3/command" -d "$3" | jq -r '"\(.name): \(.status)"'; }
S=http://sonarr:8989; SK=$(key /sonarr/config.xml) S=http://sonarr:8989; SK=$(key /sonarr/config.xml)
for id in $(curl -sf -H "X-Api-Key: $SK" "$S/api/v3/series" | jq -r '.[] | select(.monitored) | .id'); do get() { curl -sf -H "X-Api-Key: $SK" "$S/api/v3/$1"; }
cmd "$S" "$SK" "{\"name\":\"SeriesSearch\",\"seriesId\":$id}" get series | jq -r '.[] | select(.monitored) | "\(.id) \(.qualityProfileId)"' | while read -r sid pid; do
cut=$(get "qualityprofile/$pid" | jq '.cutoffFormatScore')
low=$(get "episodefile?seriesId=$sid" | jq -c --argjson c "$cut" '[.[] | select(.customFormatScore < $c) | .id]')
ids=$(get "episode?seriesId=$sid" | jq -c --argjson low "$low" '[.[] | select(.monitored and .hasFile) | select(.episodeFileId as $f | $low | index($f)) | .id]')
if [ "$ids" != "[]" ]; then
echo "series $sid: $(echo "$ids" | jq length) episode(s) below cutoff $cut"
cmd "$S" "$SK" "{\"name\":\"EpisodeSearch\",\"episodeIds\":$ids}"
fi
done done
cmd "$S" "$SK" '{"name":"MissingEpisodeSearch"}'
R=http://radarr:7878; RK=$(key /radarr/config.xml) R=http://radarr:7878; RK=$(key /radarr/config.xml)
cmd "$R" "$RK" '{"name":"CutoffUnmetMoviesSearch"}' cmd "$R" "$RK" '{"name":"CutoffUnmetMoviesSearch"}'