2014-10-30 08:49:07 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-11-03 11:04:34 +01:00
|
|
|
#srArgs="-d"
|
2014-10-30 08:49:07 +01:00
|
|
|
|
2015-03-12 22:31:55 +01:00
|
|
|
declare -A files
|
|
|
|
|
2014-11-03 11:04:34 +01:00
|
|
|
files=(
|
2015-03-12 23:11:54 +01:00
|
|
|
# Nothing special
|
|
|
|
["Inspector_Barnaby_15.03.09_21-45_zdfneo_100_TVOON_DE.mpg.HQ.avi"]="Inspector.Barnaby..S07E02..Immer.wenn.der.Scherenschleifer....HQ.avi"
|
|
|
|
|
|
|
|
# Remove 3 words from the beginning and some from the end
|
|
|
|
["Bibi_Blocksberg_15.03.07_08-30_zdf_30_TVOON_DE.mpg.avi"]="Bibi.Blocksberg..S01E06..Bibi.im.Dschungel.avi"
|
|
|
|
# Use season and episode information from the beginning
|
2015-04-06 23:01:10 +02:00
|
|
|
["S05_E22_Good_Wife_15.03.11_00-40_sixx_40_TVOON_DE.mpg.HQ.avi"]="Good.Wife..S05E22..Ein.seltsames.Jahr.HQ.avi"
|
|
|
|
# Use season and episode information from the end
|
|
|
|
["Bibi_Blocksberg_S02E07_15.04.05_07-20_zdf_25_TVOON_DE.mpg.avi.otrkey"]="Bibi.Blocksberg..S02E07..Der.Hexengeburtstag.otrkey"
|
2015-03-12 23:11:54 +01:00
|
|
|
# Cut 3 words from the end
|
|
|
|
["Good_Wife_15.03.11_00-40_sixx_40_TVOON_DE.mpg.HQ.avi.otrkey"]="Good.Wife..S05E22..Ein.seltsames.Jahr.otrkey"
|
|
|
|
# Use , as delimiter
|
|
|
|
["H2O_Ploetzlich_Meerjungfrau_15.02.28_11-55_orf1_30_TVOON_DE.mpg.avi.otrkey"]="H2O.-.Plötzlich.Meerjungfrau..S03E06..Bella.irrt.otrkey"
|
2015-09-23 17:39:17 +02:00
|
|
|
# Series and episode name in title
|
|
|
|
["Irene_Huss_Kripo_Goeteborg_Der_im_Dunkeln_wacht_S02E01_15.08.08_22-55_ard_90_TVOON_DE.mpg.HQ.avi"]="Irene.Huss,.Kripo.Göteborg..S02E01..Der.im.Dunkeln.wacht.HQ.avi"
|
2015-11-25 08:46:00 +01:00
|
|
|
# Difficult search for series
|
|
|
|
["Ein_Fall_fuer_TKKG_S01E01_15.11.16_13-20_kika_20_TVOON_DE.mpg.avi"]="Ein.Fall.für.TKKG..S01E01..Das.leere.Grab.im.Moor.avi"
|
2014-11-03 11:04:34 +01:00
|
|
|
);
|
2014-10-30 08:49:07 +01:00
|
|
|
|
2015-03-12 22:33:07 +01:00
|
|
|
if [ -f test.sh ]; then
|
2015-03-12 22:55:34 +01:00
|
|
|
path=".."
|
2015-03-12 22:33:07 +01:00
|
|
|
else
|
2015-03-12 22:55:34 +01:00
|
|
|
path="."
|
2015-03-12 22:33:07 +01:00
|
|
|
fi
|
|
|
|
|
2015-03-12 22:55:34 +01:00
|
|
|
if [ ! -f "$path/saneRenamix.sh" ]; then
|
|
|
|
echo "saneRenamix.sh not found!" >&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for the_file in "${!files[@]}"; do
|
|
|
|
echo -e "\033[37m${the_file}";
|
|
|
|
|
|
|
|
file="${the_file//_/ }"
|
|
|
|
|
|
|
|
file_title=${file%% [0-9][0-9].*} # Cut off everything after the title: date, hour, sender, ...
|
|
|
|
file_sender=${file##*-[0-9][0-9]} # Cut off everything bevor the sender: title, date, time, ...
|
|
|
|
|
|
|
|
file_date=${file%%$file_sender} # Cut off the sender
|
|
|
|
file_date=${file_date##$file_title } # Cut off the title, now we do have the date and time
|
|
|
|
file_time=${file_date##* }
|
|
|
|
file_date=${file_date%% *}
|
|
|
|
|
|
|
|
epg_file="epg-$file_date.csv"
|
|
|
|
|
|
|
|
if ! [ -f $path/$epg_file ]; then # Create EPG file if neccessary
|
|
|
|
ln -s "testing/$epg_file" "$path/$epg_file"
|
|
|
|
fi
|
|
|
|
|
|
|
|
result="$($path/saneRenamix.sh $srArgs -s -f "$the_file")";
|
2014-10-30 08:49:07 +01:00
|
|
|
|
2015-03-12 22:55:34 +01:00
|
|
|
if [ "$result" != "${files["$the_file"]}" ]; then
|
|
|
|
echo -e "\033[31m$the_file -> $result";
|
|
|
|
echo "'$result' != '${files[$the_file]}'";
|
2015-09-23 17:39:17 +02:00
|
|
|
else
|
|
|
|
if [ -L $path/$epg_file ]; then # We have created it above
|
|
|
|
rm $path/$epg_file
|
|
|
|
fi
|
2014-10-30 08:49:07 +01:00
|
|
|
fi
|
2014-11-03 11:04:34 +01:00
|
|
|
done;
|