mirror of
https://github.com/Jonny007-MKD/OTR-SaneRename
synced 2025-01-22 08:49:48 +01:00
Added caching for series IDs (file: series.cache, delimiter: |#|)
This commit is contained in:
parent
fab0b98d01
commit
44f599b7f0
1 changed files with 34 additions and 22 deletions
|
@ -107,36 +107,48 @@ eecho -e " Datum:\t$fieldsDateInv"
|
||||||
eecho -e " Uhrzeit:\t$fieldsTime"
|
eecho -e " Uhrzeit:\t$fieldsTime"
|
||||||
eecho -e " Titel:\t$fieldsTitle"
|
eecho -e " Titel:\t$fieldsTitle"
|
||||||
|
|
||||||
# ------------ Series ID abrufen anhand vom Titel der Serie -------------------- ;;
|
if [ -f "$PwD/series.cache" ]; then # Search the series cache
|
||||||
series_db="https://www.thetvdb.com/api/GetSeries.php?seriesname=$fieldsTitle&language=$lang"
|
series_id=$(grep "$series_title" "$PwD/series.cache");
|
||||||
wget "$series_db" -O "$PwD/series.xml" -o /dev/null
|
fi
|
||||||
error=$?
|
if [ -n "$series_id" ]; then # And get the TvDB series ID from there
|
||||||
if [ $error -ne 0 ]; then
|
echo $series_id
|
||||||
|
series_title=${series_id%|#|*}
|
||||||
|
series_id=${series_id#*|#|}
|
||||||
|
eecho -e " Cache:\tSeries found.\tID: $series_id"
|
||||||
|
else # Otherwise ask TvDB whether they do know the series
|
||||||
|
# ------------ Series ID abrufen anhand vom Titel der Serie -------------------- ;;
|
||||||
|
series_db="https://www.thetvdb.com/api/GetSeries.php?seriesname=$fieldsTitle&language=$lang"
|
||||||
|
wget "$series_db" -O "$PwD/series.xml" -o /dev/null
|
||||||
|
error=$?
|
||||||
|
if [ $error -ne 0 ]; then
|
||||||
eecho "Downloading $series_db failed (Exit code: $error)!"
|
eecho "Downloading $series_db failed (Exit code: $error)!"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
series_id=$(grep -m 1 "seriesid" "$PwD/series.xml") # Get series id (needed later)
|
series_id=$(grep -m 1 "seriesid" "$PwD/series.xml") # Get series id (needed later)
|
||||||
if [ -z "$series_id" ]; then
|
if [ -z "$series_id" ]; then
|
||||||
eecho -e " TVDB:\tSeries NOT found!"
|
eecho -e " TVDB:\tSeries NOT found!"
|
||||||
exit 3
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
series_title=$(grep -m 1 "SeriesName" "$PwD/series.xml") # Get series name from TvDB (for user)
|
||||||
|
series_alias=$(grep -m 1 "AliasName" "$PwD/series.xml")
|
||||||
|
series_id=${series_id%<*} # Remove XML tags
|
||||||
|
series_id=${series_id#*>}
|
||||||
|
series_title=${series_title%<*}
|
||||||
|
series_title=${series_title#*>}
|
||||||
|
series_alias=${series_alias%<*}
|
||||||
|
series_alias=${series_alias#*>}
|
||||||
|
|
||||||
|
eecho -e " TVDB:\tSeries found.\tID: $series_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
series_title=$(grep -m 1 "SeriesName" "$PwD/series.xml") # Get series name from TvDB (for user)
|
|
||||||
series_alias=$(grep -m 1 "AliasName" "$PwD/series.xml")
|
|
||||||
series_id=${series_id%<*} # Remove XML tags
|
|
||||||
series_id=${series_id#*>}
|
|
||||||
series_title=${series_title%<*}
|
|
||||||
series_title=${series_title#*>}
|
|
||||||
series_alias=${series_alias%<*}
|
|
||||||
series_alias=${series_alias#*>}
|
|
||||||
|
|
||||||
eecho -e " TVDB:\tSeries found.\tID: $series_id"
|
|
||||||
eecho -e "\t\t\t\tName: $series_title"
|
eecho -e "\t\t\t\tName: $series_title"
|
||||||
if [ -n "$series_alias" ]; then
|
if [ -n "$series_alias" ]; then
|
||||||
eecho -e "\t\t\t\tAlias: $series_alias"
|
eecho -e "\t\t\t\tAlias: $series_alias"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$series_title|#|$series_id" >> "$PwD/series.cache"
|
||||||
|
|
||||||
# ------------ EPG vom jeweiligen Tag herunterladen, durchsuchen anhand der Ausstrahlungszeit ------------- ;;
|
# ------------ EPG vom jeweiligen Tag herunterladen, durchsuchen anhand der Ausstrahlungszeit ------------- ;;
|
||||||
# Download OTR EPG data and search for series and time
|
# Download OTR EPG data and search for series and time
|
||||||
if [ ! -f "PwD/epg-$fieldsDate.csv" ]; then # didnt cache this file
|
if [ ! -f "PwD/epg-$fieldsDate.csv" ]; then # didnt cache this file
|
||||||
|
|
Loading…
Reference in a new issue