1
0
Fork 0
mirror of https://github.com/Jonny007-MKD/OTR-SaneRename synced 2024-05-19 23:44:02 +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 # Download OTR EPG data and search for series and time
wget_file="$PwD/epg-${file_date}.csv" wget_file="$PwD/epg-${file_date}.csv"
if [ ! -f "$wget_file" ]; then # This EPG file does not exist 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" epg_csv="https://www.onlinetvrecorder.com/epg/csv/epg_20${file_date//./_}.csv"
wget_running=true; wget_running=true;
wget "$epg_csv" -O "$wget_file" -o /dev/null # Download the csv wget "$epg_csv" -O "$wget_file" -o /dev/null # Download the csv
@ -272,7 +272,7 @@ function funcGetEpisodeInfo {
break; break;
fi fi
title="$tmp" title="$tmp"
eecho -e " EPG:\tEpisode title:\t$title" eecho -e " \tEpisode title:\t$title"
else else
break; break;
fi fi
@ -280,7 +280,7 @@ function funcGetEpisodeInfo {
if [ -z "$episode_info" ]; then # If we have not found anything if [ -z "$episode_info" ]; then # If we have not found anything
tmp="${episode_title%% *}" # Get the first wird tmp="${episode_title%% *}" # Get the first wird
title="${episode_title#$tmp }" # Remove it from the title 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 episode_info=$(grep "Name>$title" "$wget_file" -B 10) # Get XML data of episode
fi fi
episode_title="$title" episode_title="$title"
@ -361,9 +361,20 @@ function doIt {
if [ "$lang" != "en" ]; then if [ "$lang" != "en" ]; then
doItEpisodes "en" # Try it again with english doItEpisodes "en" # Try it again with english
fi fi
if [ -z "$episode_info" ]; then # Again/still no info found! Damn :( fi
echo "No episode info found!"
exit 20 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
fi fi