mirror of
				https://github.com/Jonny007-MKD/OTR-SaneRename
				synced 2025-11-03 16:15:35 +01:00 
			
		
		
		
	Dont exit (12) 1st time TheTvDB returns too many series
This commit is contained in:
		
							parent
							
								
									4569f1e74a
								
							
						
					
					
						commit
						d432c440a2
					
				
					 2 changed files with 16 additions and 5 deletions
				
			
		| 
						 | 
					@ -186,11 +186,11 @@ function funcGetSeriesId {
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	if [ -z "$series_id" ]; then									# Otherwise ask TvDB whether they do know the series
 | 
						if [ -z "$series_id" ]; then									# Otherwise ask TvDB whether they do know the series
 | 
				
			||||||
		funcGetSeriesIdFromTvdb "$file_title"
 | 
							funcGetSeriesIdFromTvdb "$file_title" false
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	if [ -z "$series_id" ]; then									# Otherwise ask TvDB with translation
 | 
						if [ -z "$series_id" ]; then									# Otherwise ask TvDB with translation
 | 
				
			||||||
		funcConvertName "$file_title"
 | 
							funcConvertName "$file_title"
 | 
				
			||||||
		funcGetSeriesIdFromTvdb "$tmp"
 | 
							funcGetSeriesIdFromTvdb "$tmp" true
 | 
				
			||||||
	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!"
 | 
				
			||||||
| 
						 | 
					@ -232,7 +232,9 @@ function funcGetSeriesIdFromTvdb {
 | 
				
			||||||
	if $debug; then echo -e "\033[36mfuncGetSeriesIdFromTvdb $1\033[37m"; fi;
 | 
						if $debug; then echo -e "\033[36mfuncGetSeriesIdFromTvdb $1\033[37m"; fi;
 | 
				
			||||||
	local title;
 | 
						local title;
 | 
				
			||||||
	local tmp;
 | 
						local tmp;
 | 
				
			||||||
 | 
						local lastChance;
 | 
				
			||||||
	title="$1";
 | 
						title="$1";
 | 
				
			||||||
 | 
						lastChance="$2";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while true; do
 | 
						while true; do
 | 
				
			||||||
		series_db="https://www.thetvdb.com/api/GetSeries.php?seriesname=${title}&language=$lang"
 | 
							series_db="https://www.thetvdb.com/api/GetSeries.php?seriesname=${title}&language=$lang"
 | 
				
			||||||
| 
						 | 
					@ -247,14 +249,21 @@ function funcGetSeriesIdFromTvdb {
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if $debug; then echo -e "grep -Ei -m 1 -B 3 -A 1 \">${title// /\\W+}<\" \"$wget_file\")"; fi;
 | 
				
			||||||
		tmp="$(grep -Ei -m 1 -B 3 -A 1 ">${title// /\\W+}<" "$wget_file")"
 | 
							tmp="$(grep -Ei -m 1 -B 3 -A 1 ">${title// /\\W+}<" "$wget_file")"
 | 
				
			||||||
		if [ ${#tmp} -eq 0 ]; then										# No series with this name found
 | 
							if [ ${#tmp} -eq 0 ]; then										# No series with this name found
 | 
				
			||||||
			tmp="$(grep -Pzo --binary-files=text "(?s)>langCurrent</language>\n<SeriesName>" "$wget_file")"						# Let's get all series from the query
 | 
								if $debug; then echo -e "grep -Pzo --binary-files=text \"(?s)>$langCurrent</language>\n<SeriesName>\" \"$wget_file\")"; fi;
 | 
				
			||||||
 | 
								tmp="$(grep -Pzo --binary-files=text "(?s)>$langCurrent</language>\n<SeriesName>" "$wget_file")"						# Let's get all series from the query
 | 
				
			||||||
			if [ $(echo "$tmp" | wc -l) -eq 1 ]; then					# If we only found one series
 | 
								if [ $(echo "$tmp" | wc -l) -eq 1 ]; then					# If we only found one series
 | 
				
			||||||
 | 
									if $debug; then echo -e "grep -Pzo --binary-files=text \"(?s)<Series>.*?$langCurrent</language>.*?</SeriesName>\" \"$wget_file\")"; fi;
 | 
				
			||||||
				tmp="$(grep -Pzo --binary-files=text "(?s)<Series>.*?$langCurrent</language>.*?</SeriesName>" "$wget_file")"	# Lets use this one
 | 
									tmp="$(grep -Pzo --binary-files=text "(?s)<Series>.*?$langCurrent</language>.*?</SeriesName>" "$wget_file")"	# Lets use this one
 | 
				
			||||||
			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 title \"$title\""
 | 
				
			||||||
 | 
									if $lastChance; then									# If we really had to find a value now
 | 
				
			||||||
					logNexit 12
 | 
										logNexit 12
 | 
				
			||||||
 | 
									else													# If we may try something else
 | 
				
			||||||
 | 
										return
 | 
				
			||||||
 | 
									fi
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		if [ -n "$tmp" ]; then
 | 
							if [ -n "$tmp" ]; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,8 @@ files=(
 | 
				
			||||||
	["H2O_Ploetzlich_Meerjungfrau_15.02.28_11-55_orf1_30_TVOON_DE.mpg.avi.otrkey"]="H2O.-.Plötzlich.Meerjungfrau..S03E06..Bella.irrt.otrkey"
 | 
						["H2O_Ploetzlich_Meerjungfrau_15.02.28_11-55_orf1_30_TVOON_DE.mpg.avi.otrkey"]="H2O.-.Plötzlich.Meerjungfrau..S03E06..Bella.irrt.otrkey"
 | 
				
			||||||
# Series and episode name in title
 | 
					# 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"
 | 
						["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"
 | 
				
			||||||
 | 
					# 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"
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -f test.sh ]; then
 | 
					if [ -f test.sh ]; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue