mirror of
https://github.com/Jonny007-MKD/OTR-SaneRename
synced 2025-01-22 08:49:48 +01:00
Shorten the found episode title from EPG until it is found in episodes.xml (in case the title is not separated with a "." in EPG)
This commit is contained in:
parent
64f349ecba
commit
c1cc76e62a
1 changed files with 22 additions and 4 deletions
|
@ -21,9 +21,11 @@ while getopts "f:l:s" optval; do
|
||||||
"l")
|
"l")
|
||||||
lang="$OPTARG";;
|
lang="$OPTARG";;
|
||||||
"?")
|
"?")
|
||||||
echo "Usage: $0 -f pathToAvi [-s] [-l LANG]";;
|
echo "Usage: $0 -f pathToAvi [-s] [-l LANG]"
|
||||||
|
exit;;
|
||||||
":")
|
":")
|
||||||
echo "No argument value for option $OPTARG";;
|
echo "No argument value for option $OPTARG"
|
||||||
|
exit;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -34,6 +36,7 @@ eecho
|
||||||
|
|
||||||
if [ -z "$path" ]; then
|
if [ -z "$path" ]; then
|
||||||
echo "Usage: $0 -f pathToAvi [-s] [-l LANG]"
|
echo "Usage: $0 -f pathToAvi [-s] [-l LANG]"
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$lang" in
|
case "$lang" in
|
||||||
|
@ -137,7 +140,7 @@ fi
|
||||||
# ------------ 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
|
||||||
rm -f "$PWD/epg-*.csv" 2> /dev/null
|
rm -f ${$PWD// /\\ }/epg-*.csv 2> /dev/null
|
||||||
epg_datei="https://www.onlinetvrecorder.com/epg/csv/epg_20${fieldsDate//./_}.csv"
|
epg_datei="https://www.onlinetvrecorder.com/epg/csv/epg_20${fieldsDate//./_}.csv"
|
||||||
wget "$epg_datei" -O "$PWD/epg-$fieldsDate.csv" -o /dev/null
|
wget "$epg_datei" -O "$PWD/epg-$fieldsDate.csv" -o /dev/null
|
||||||
error=$?
|
error=$?
|
||||||
|
@ -178,7 +181,22 @@ if [ $error -ne 0 ]; then
|
||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
episode_info=$(grep "$episode_title" "$PWD/episodes.xml" -B 10) # Get XML data of episode
|
while true; do
|
||||||
|
episode_info=$(grep "$episode_title" "$PWD/episodes.xml" -B 10) # Get XML data of episode
|
||||||
|
if [ -z "$episode_info" ]; then
|
||||||
|
episode_title=${episode_title% *}
|
||||||
|
eecho -e " EPG:\tEpisode title:\t$episode_title"
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z "$episode_info" ]; then
|
||||||
|
echo "No episode info found"
|
||||||
|
exit 13
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
episode_number=$(echo -e "$episode_info" | grep -m 1 "episodenumber") # Get episode number
|
episode_number=$(echo -e "$episode_info" | grep -m 1 "episodenumber") # Get episode number
|
||||||
episode_season=$(echo -e "$episode_info" | grep -m 1 "season") # Get season number
|
episode_season=$(echo -e "$episode_info" | grep -m 1 "season") # Get season number
|
||||||
episode_number=${episode_number%<*} # remove xml tags
|
episode_number=${episode_number%<*} # remove xml tags
|
||||||
|
|
Loading…
Reference in a new issue