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...
This commit is contained in:
RandomNinjaAtk 2023-11-04 14:44:55 -04:00 committed by GitHub
parent 7f694337f9
commit 6277da3971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion="1.4"
scriptVersion="1.5"
scriptName="SeriesEpisodeTrimmer"
#### Import Settings
@ -45,14 +45,19 @@ else
fi
done
fi
# Verify series is marked as "daily" type by sonarr, skip if not...
if [ $seriesType != "daily" ] && [ "$tagMatch" == "false" ]; then
log "$seriesTitle (ID:$seriesId) :: ERROR :: Series does not match TYPE: Daily or TAG: $sonarrSeriesEpisodeTrimmerTag, skipping..."
exit
fi
# Skip processing if less than 14 episodes were found to be downloaded
# If non-daily series, set maximum episode count to match latest season total episode count
if [ $seriesType != "daily" ]; then
maximumDailyEpisodes=$(echo "$seriesData" | jq -r ".seasons | sort_by(.seasonNumber) | reverse | .[].statistics.totalEpisodeCount" | head -n1)
fi
# Skip processing if less than the maximumDailyEpisodes setting were found to be downloaded
if [ $seriesEpisodeIdsCount -lt $maximumDailyEpisodes ]; then
log "$seriesTitle (ID:$seriesId) :: ERROR :: Series has not exceeded $maximumDailyEpisodes downloaded episodes ($seriesEpisodeIdsCount files found), skipping..."
exit