1
0
Fork 0
mirror of https://github.com/Jonny007-MKD/OTR-SaneRename synced 2025-01-22 08:49:48 +01:00

Added option to disable series ID cache

This commit is contained in:
Jonny007-MKD 2015-11-25 09:03:56 +01:00
parent d432c440a2
commit 551987038f
2 changed files with 25 additions and 6 deletions

View file

@ -29,6 +29,7 @@ apikey="2C9BB45EFB08AD3B"
productname="SaneRename for OTR (ALPHA) v0.4" productname="SaneRename for OTR (ALPHA) v0.4"
lang="de" lang="de"
debug=false debug=false
cache=true
########## ##########
@ -62,10 +63,12 @@ wget_running=false;
# Parse the parameters # Parse the parameters
function funcParam { function funcParam {
while getopts "df:l:s" optval; do while getopts "dcf:l:s" optval; do
case $optval in case $optval in
"d") # Enable debugging "d") # Enable debugging
debug=true;; debug=true;;
"c") # Disable series ID cache
cache=false;;
"f") # Path to file "f") # Path to file
path="$OPTARG";; path="$OPTARG";;
"s") # Silent switch "s") # Silent switch
@ -84,8 +87,9 @@ function funcParam {
exit 2;; exit 2;;
esac;; esac;;
"?") # Help "?") # Help
echo "Usage: $0 -f pathToAvi [-s] [-l LANG]" echo "Usage: $0 -f pathToAvi [-c] [-s] [-l LANG]"
echo echo
echo "-c disables the series ID cache on the local drive"
echo "-s makes this script to only output the filename" echo "-s makes this script to only output the filename"
echo "-l lets you search TheTVDB in a different language" echo "-l lets you search TheTVDB in a different language"
exit;; exit;;
@ -178,7 +182,7 @@ function funcConvertName {
function funcGetSeriesId { function funcGetSeriesId {
if $debug; then echo -e "\033[36mfuncGetSeriesId\033[37m"; fi; if $debug; then echo -e "\033[36mfuncGetSeriesId\033[37m"; fi;
local tmp; local tmp;
if [ -f "$PwD/series.cache" ]; then # Search the series cache if $cache && [ -f "$PwD/series.cache" ]; then # Search the series cache
funcGetSeriesIdFromCache "$file_title" funcGetSeriesIdFromCache "$file_title"
if [ -z "$series_id" ]; then # and search the cache with translation if [ -z "$series_id" ]; then # and search the cache with translation
funcConvertName "$file_title" funcConvertName "$file_title"
@ -233,6 +237,7 @@ function funcGetSeriesIdFromTvdb {
local title; local title;
local tmp; local tmp;
local lastChance; local lastChance;
local cacheLine;
title="$1"; title="$1";
lastChance="$2"; lastChance="$2";
@ -279,7 +284,15 @@ function funcGetSeriesIdFromTvdb {
series_alias=${series_alias#*>} series_alias=${series_alias#*>}
if [ -n "$series_id" -a -n "$series_title_tvdb" ]; then if [ -n "$series_id" -a -n "$series_title_tvdb" ]; then
echo "$file_title|_|$series_title_tvdb|#|$series_id" >> "$PwD/series.cache" cacheLine="$file_title|_|$series_title_tvdb|#|$series_id"
if [ -f "$PwD/series.cache" ]; then
tmp="$(grep "$cacheLine" "$PwD/series.cache")"
else
tmp=
fi
if [ -z "$tmp" ]; then
echo $cacheLine >> "$PwD/series.cache"
fi
eecho -e " TVDB:\tSeries found.\tID: $series_id" eecho -e " TVDB:\tSeries found.\tID: $series_id"
eecho -e " \t \tName: $series_title_tvdb" eecho -e " \t \tName: $series_title_tvdb"
fi fi

View file

@ -54,10 +54,16 @@ for the_file in "${!files[@]}"; do
ln -s "testing/$epg_file" "$path/$epg_file" ln -s "testing/$epg_file" "$path/$epg_file"
fi fi
result="$($path/saneRenamix.sh $srArgs -s -f "$the_file")"; result="$($path/saneRenamix.sh $srArgs -c -s -f "$the_file")";
if [ "$result" != "${files["$the_file"]}" ]; then if [ "$result" != "${files["$the_file"]}" ]; then
echo -e "\033[31m$the_file -> $result"; echo -e "\033[31m$the_file -> $result (nocache)";
echo "'$result' != '${files[$the_file]}'";
fi
result="$($path/saneRenamix.sh $srArgs -s -f "$the_file")";
if [ "$result" != "${files["$the_file"]}" ]; then
echo -e "\033[31m$the_file -> $result (cache)";
echo "'$result' != '${files[$the_file]}'"; echo "'$result' != '${files[$the_file]}'";
else else
if [ -L $path/$epg_file ]; then # We have created it above if [ -L $path/$epg_file ]; then # We have created it above