1
0
Fork 0
mirror of https://github.com/Jonny007-MKD/OTR-SaneRename synced 2024-05-19 23:44:02 +02:00

Added logging of uncompleted files

This commit is contained in:
Jonny007-MKD 2014-08-19 00:28:38 +02:00
parent c284b6544e
commit fc032ff005

View file

@ -30,6 +30,11 @@ function eecho {
fi fi
} }
function logNexit {
echo "$1 - $file_name - $series_title" >> "$PwD/log"
exit $1
}
# trap ctrl-c and call ctrl_c() # trap ctrl-c and call ctrl_c()
trap ctrl_c INT trap ctrl_c INT
function ctrl_c() { function ctrl_c() {
@ -128,7 +133,7 @@ function funcGetSeriesId {
fi fi
if [ -z "$series_id" ]; then # This series was not found anywhere :( if [ -z "$series_id" ]; then # This series was not found anywhere :(
eecho -e " TVDB:\tSeries not found!" eecho -e " TVDB:\tSeries not found!"
exit 10 logNexit 10
fi fi
eecho -e " \t\t\tName:\t$series_title" eecho -e " \t\t\tName:\t$series_title"
@ -171,7 +176,7 @@ function funcGetSeriesIdFromTvdb {
wget_running=false; wget_running=false;
error=$? error=$?
if [ $error -ne 0 ]; then if [ $error -ne 0 ]; then
eecho -e "\t\t\tDownloading $series_db failed (Exit code: $error)!" eecho -e "\t\t\tDownloading $series_db failed \(Exit code: $error\)!"
fi fi
tmp="$(grep -m 1 -B 3 -A 1 ">$title<" "$wget_file")" tmp="$(grep -m 1 -B 3 -A 1 ">$title<" "$wget_file")"
if [ ${#tmp} -eq 0 ]; then # No series with this name found if [ ${#tmp} -eq 0 ]; then # No series with this name found
@ -180,7 +185,7 @@ function funcGetSeriesIdFromTvdb {
tmp="$(grep -B 3 -A 1 "<SeriesName>" "$wget_file")" # Lets use this one tmp="$(grep -B 3 -A 1 "<SeriesName>" "$wget_file")" # Lets use this one
episode_title_set=false episode_title_set=false
else else
eecho -e " TvDB: $(echo "$tmp" | wc -l) series found with this title ($title)" eecho -e " TvDB: $(echo "$tmp" | wc -l) series found with this title \($title\)"
fi fi
fi fi
if [ -n "$tmp" ]; then if [ -n "$tmp" ]; then
@ -220,14 +225,14 @@ function funcGetEPG {
error=$? error=$?
if [ $error -ne 0 ]; then if [ $error -ne 0 ]; then
eecho "Downloading $epg_csv failed (Exit code: $error)!" eecho "Downloading $epg_csv failed (Exit code: $error)!"
exit 40 logNexit 40
fi fi
fi fi
epg="$(grep "$series_title" "$wget_file" | grep "${file_time}")" # Get the line with the movie epg="$(grep "$series_title" "$wget_file" | grep "${file_time}")" # Get the line with the movie
if [ -z "$epg" ]; then if [ -z "$epg" ]; then
eecho -e " EPG:\tSeries \"$series_title\" not found in EPG data" # This cannot happen :) eecho -e " EPG:\tSeries \"$series_title\" not found in EPG data" # This cannot happen :)
exit 11 logNexit 11
fi fi
# Parse EPG data using read # Parse EPG data using read
OLDIFS=$IF OLDIFS=$IF
@ -263,7 +268,7 @@ function funcGetEpisodes {
error=$? error=$?
if [ $error -ne 0 ]; then if [ $error -ne 0 ]; then
eecho "Downloading $episode_db failed (Exit code: $error)!" eecho "Downloading $episode_db failed (Exit code: $error)!"
exit 41 logNexit 41
fi fi
fi fi
} }
@ -382,15 +387,15 @@ function doIt {
fi fi
if [ -z "$episode_info" ]; then # Again/still no info found! Damn :( if [ -z "$episode_info" ]; then # Again/still no info found! Damn :(
echo "No episode info found!" echo "No episode info found!"
exit 20 logNexit 20
fi fi
fi fi
fi fi
if [ -n "$episode_info" ]; then if [ -n "$episode_info" ] && [ -n "$series_title" ]; then
funcMakeFilename funcMakeFilename
exit 0 logNexit 0
fi fi
} }
@ -410,11 +415,11 @@ function doItEpisodes {
funcGetEpisodeInfo funcGetEpisodeInfo
else else
eecho -e " EPG:\tNo episode title found in EPG!" eecho -e " EPG:\tNo episode title found in EPG!"
exit 21 logNexit 21
fi fi
fi fi
} }
funcParam $@ funcParam $@
doIt doIt
exit 20 logNexit 20