mirror of
				https://github.com/Jonny007-MKD/OTR-SaneRename
				synced 2025-11-03 16:15:35 +01:00 
			
		
		
		
	Downloaded files expire after 2 weeks
This commit is contained in:
		
							parent
							
								
									f92e49317c
								
							
						
					
					
						commit
						dc2e036036
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -248,6 +248,12 @@ function funcGetSeriesIdFromTvdb {
 | 
				
			||||||
function funcGetEPG {
 | 
					function funcGetEPG {
 | 
				
			||||||
	# Download OTR EPG data and search for series and time
 | 
						# Download OTR EPG data and search for series and time
 | 
				
			||||||
	wget_file="$PwD/epg-${file_date}.csv"
 | 
						wget_file="$PwD/epg-${file_date}.csv"
 | 
				
			||||||
 | 
						if [ -f "$wget_file" ]; then
 | 
				
			||||||
 | 
							wget_file_date=$(stat --format=%Y "$wget_file")
 | 
				
			||||||
 | 
							if [ $(( $(date +%s) - $wget_file_date)) -gt $((60*60*24*7*2)) ]; then		# if file is older than 2 weeks
 | 
				
			||||||
 | 
								rm "$wget_file"
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
	if [ ! -f "$wget_file" ]; then										# This EPG file does not exist
 | 
						if [ ! -f "$wget_file" ]; then										# This EPG file does not exist
 | 
				
			||||||
		#rm -f ${PwD// /\\ }/epg-*.csv 2> /dev/null						# Delete all old files
 | 
							#rm -f ${PwD// /\\ }/epg-*.csv 2> /dev/null						# Delete all old files
 | 
				
			||||||
		epg_csv="https://www.onlinetvrecorder.com/epg/csv/epg_20${file_date//./_}.csv"
 | 
							epg_csv="https://www.onlinetvrecorder.com/epg/csv/epg_20${file_date//./_}.csv"
 | 
				
			||||||
| 
						 | 
					@ -304,6 +310,12 @@ function funcGetEpgEpisodeTitle {
 | 
				
			||||||
# Download episodes list  from TvDB, language as argument
 | 
					# Download episodes list  from TvDB, language as argument
 | 
				
			||||||
function funcGetEpisodes {
 | 
					function funcGetEpisodes {
 | 
				
			||||||
	wget_file="$PwD/episodes-${series_id}.xml"
 | 
						wget_file="$PwD/episodes-${series_id}.xml"
 | 
				
			||||||
 | 
						if [ -f "$wget_file" ]; then
 | 
				
			||||||
 | 
							wget_file_date=$(stat --format=%Y "$wget_file")
 | 
				
			||||||
 | 
							if [ $(( $(date +%s) - $wget_file_date)) -gt $(( 60*60*24*7*2 )) ]; then		# if file is older than 2 weeks
 | 
				
			||||||
 | 
								rm "$wget_file"
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
	if [ ! -f "$wget_file" ]; then
 | 
						if [ ! -f "$wget_file" ]; then
 | 
				
			||||||
		# Download Episode list of series
 | 
							# Download Episode list of series
 | 
				
			||||||
		episode_db="https://www.thetvdb.com/api/$apikey/series/$series_id/all/$1.xml"
 | 
							episode_db="https://www.thetvdb.com/api/$apikey/series/$series_id/all/$1.xml"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue