Skip to content

Commit 6277da3

Browse files
v1.5 - If non-daily series keep entire season worth of media
#105 This change ignores your custom episode count for series that are not considered daily and keeps the number of episodes that match the latest season episode count. Which is likely more desirable for TV series that want to have a rolling episode count, to ensure you can pickup watching the series at any given time during the latest season and miss anything...
1 parent 7f69433 commit 6277da3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sonarr/DailySeriesEpisodeTrimmer.bash

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
scriptVersion="1.4"
2+
scriptVersion="1.5"
33
scriptName="SeriesEpisodeTrimmer"
44

55
#### Import Settings
@@ -45,14 +45,19 @@ else
4545
fi
4646
done
4747
fi
48+
4849
# Verify series is marked as "daily" type by sonarr, skip if not...
4950
if [ $seriesType != "daily" ] && [ "$tagMatch" == "false" ]; then
5051
log "$seriesTitle (ID:$seriesId) :: ERROR :: Series does not match TYPE: Daily or TAG: $sonarrSeriesEpisodeTrimmerTag, skipping..."
5152
exit
5253
fi
5354

54-
55-
# Skip processing if less than 14 episodes were found to be downloaded
55+
# If non-daily series, set maximum episode count to match latest season total episode count
56+
if [ $seriesType != "daily" ]; then
57+
maximumDailyEpisodes=$(echo "$seriesData" | jq -r ".seasons | sort_by(.seasonNumber) | reverse | .[].statistics.totalEpisodeCount" | head -n1)
58+
fi
59+
60+
# Skip processing if less than the maximumDailyEpisodes setting were found to be downloaded
5661
if [ $seriesEpisodeIdsCount -lt $maximumDailyEpisodes ]; then
5762
log "$seriesTitle (ID:$seriesId) :: ERROR :: Series has not exceeded $maximumDailyEpisodes downloaded episodes ($seriesEpisodeIdsCount files found), skipping..."
5863
exit

0 commit comments

Comments
 (0)