1
0
Fork 0
mirror of https://github.com/Jonny007-MKD/OTR-SaneRename synced 2024-05-08 21:54:04 +02:00

If no episode was found with the episode title from the file name we will search the EPG for an appropriate title

This commit is contained in:
Jonny007-MKD 2014-08-06 18:04:41 +02:00
parent b99dc140b9
commit 97589364f9

View file

@ -203,7 +203,7 @@ function funcGetEPG {
# Download OTR EPG data and search for series and time
wget_file="$PwD/epg-${file_date}.csv"
if [ ! -f "$wget_file" ]; then # This EPG file does not exist
rm -f ${PwD// /\\ }/epg-*.csv 2> /dev/null # Delete all old files
#rm -f ${PwD// /\\ }/epg-*.csv 2> /dev/null # Delete all old files
epg_csv="https://www.onlinetvrecorder.com/epg/csv/epg_20${file_date//./_}.csv"
wget_running=true;
wget "$epg_csv" -O "$wget_file" -o /dev/null # Download the csv
@ -272,7 +272,7 @@ function funcGetEpisodeInfo {
break;
fi
title="$tmp"
eecho -e " EPG:\tEpisode title:\t$title"
eecho -e " \tEpisode title:\t$title"
else
break;
fi
@ -280,7 +280,7 @@ function funcGetEpisodeInfo {
if [ -z "$episode_info" ]; then # If we have not found anything
tmp="${episode_title%% *}" # Get the first wird
title="${episode_title#$tmp }" # Remove it from the title
eecho -e " EPG:\tEpisode title:\t$title"
eecho -e " \tEpisode title:\t$title"
episode_info=$(grep "Name>$title" "$wget_file" -B 10) # Get XML data of episode
fi
episode_title="$title"
@ -361,9 +361,20 @@ function doIt {
if [ "$lang" != "en" ]; then
doItEpisodes "en" # Try it again with english
fi
if [ -z "$episode_info" ]; then # Again/still no info found! Damn :(
echo "No episode info found!"
exit 20
fi
if $episode_title_set && [ -z "$episode_info" ]; then # Episode was not found!
episode_title_set=false # Do not use file name as episode title
funcGetEPG # Download epg file
doItEpisodes $lang # Search for the episode in the specified language and get title from EPG
if [ -z "$episode_info" ]; then # Episode was not found!
if [ "$lang" != "en" ]; then
doItEpisodes "en" # Try it again with english
fi
if [ -z "$episode_info" ]; then # Again/still no info found! Damn :(
echo "No episode info found!"
exit 20
fi
fi
fi