From 91638a319fa2b3146b8da2b56eba0f159fe5b567 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Fri, 19 Sep 2014 22:14:36 +0200 Subject: [PATCH] Fix errors in searching the cache --- saneRenamix.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/saneRenamix.sh b/saneRenamix.sh index a3d4b24..827df1c 100755 --- a/saneRenamix.sh +++ b/saneRenamix.sh @@ -145,13 +145,16 @@ function funcConvertName { function funcGetSeriesId { local tmp; if [ -f "$PwD/series.cache" ]; then # Search the series cache - funcGetSeriesIdFromCache + funcGetSeriesIdFromCache "$file_title" + fi + if [ -z "$series_id" ]; then # Otherwise search the cache with translation + funcConvertName "$file_title" + funcGetSeriesIdFromCache "$tmp" fi if [ -z "$series_id" ]; then # Otherwise ask TvDB whether they do know the series funcGetSeriesIdFromTvdb "$file_title" fi - if [ -z "$series_id" ]; then # Otherwise ask TvDB whether they do know the series - funcConvertName "$file_title" + if [ -z "$series_id" ]; then # Otherwise ask TvDB with translation funcGetSeriesIdFromTvdb "$tmp" fi if [ -z "$series_id" ]; then # This series was not found anywhere :( @@ -168,9 +171,9 @@ function funcGetSeriesId { function funcGetSeriesIdFromCache { local title; local tmp; - title="$file_title"; + title="$1"; while true; do - series_id="$(grep "$title|" "$PwD/series.cache")" # Search for this title in the cache + series_id="$(grep "$title|" "$PwD/series.cache")" # Search for this title in the cache if [ -n "$series_id" ]; then # Stop if we have found something series_title_file="${series_id%|_|*}" series_title_tvdb="${series_id#*|_|}"