mirror of
https://github.com/Jonny007-MKD/OTR-SaneRename
synced 2025-01-22 08:49:48 +01:00
NoCache option also applies to other cached files
This commit is contained in:
parent
6a782d425b
commit
3678aaafc7
1 changed files with 18 additions and 4 deletions
|
@ -89,7 +89,7 @@ function funcParam {
|
|||
"?") # Help
|
||||
echo "Usage: $0 -f pathToAvi [-c] [-s] [-l LANG]"
|
||||
echo
|
||||
echo "-c disables the series ID cache on the local drive"
|
||||
echo "-c disables the caches on the local drive"
|
||||
echo "-s makes this script to only output the filename"
|
||||
echo "-l lets you search TheTVDB in a different language"
|
||||
exit;;
|
||||
|
@ -309,12 +309,19 @@ function funcGetSeriesIdFromTvdb {
|
|||
|
||||
# Get the EPG from OnlineTvRecorder and get the title of the episode
|
||||
function funcGetEPG {
|
||||
local wget_file_date;
|
||||
local isLink;
|
||||
|
||||
if $debug; then echo -e "\033[36mfuncGetEPG\033[37m"; fi;
|
||||
# Download OTR EPG data and search for series and time
|
||||
wget_file="$PwD/epg-${file_date}.csv"
|
||||
if [ -f "$wget_file" ]; then
|
||||
wget_file_date=$(stat --format=%Z "$wget_file")
|
||||
if [ $(( $(date +%s) - $wget_file_date)) -gt $((60*60*24*7*2)) ]; then # if file is older than 2 weeks
|
||||
if [ -L "$wget_file" ]; then isLink=true; else isLink=false; fi;
|
||||
if ! $cache && ! $isLink; then # if cache is disabled and it's not a symlink
|
||||
if $debug; then echo "Deleting file because caching is disabled ($wget_file)"; fi;
|
||||
rm "$wget_file"
|
||||
elif [ $(( $(date +%s) - $wget_file_date)) -gt $((60*60*24*7*2)) ]; then # if file is older than 2 weeks
|
||||
if $debug; then echo "Deleting file with timestamp $wget_file_date ($wget_file)"; fi;
|
||||
rm "$wget_file"
|
||||
elif [ $(stat --format=%s "$wget_file") -eq 0 ]; then # if file is empty
|
||||
|
@ -386,11 +393,18 @@ function funcGetEpisodeTitleFromEpg {
|
|||
|
||||
# Download episodes list from TvDB, language as argument
|
||||
function funcDownloadEpisodesFile {
|
||||
local wget_file_date;
|
||||
local isLink;
|
||||
|
||||
if $debug; then echo -e "\033[36mfuncDownloadEpisodesFile\033[37m"; fi;
|
||||
wget_file="$PwD/episodes-${series_id}-${langCurrent}.xml"
|
||||
if [ -f "$wget_file" ]; then
|
||||
wget_file_date=$(stat --format=%Z "$wget_file")
|
||||
if [ $(( $(date +%s) - $wget_file_date)) -gt $(( 60*60*24*2 )) ]; then # if file is older than 2 days
|
||||
if [ -L "$wget_file" ]; then isLink=true; else isLink=false; fi;
|
||||
if ! $cache && ! $isLink; then # if cache is disabled and it's not a symlink
|
||||
if $debug; then echo "Deleting file because caching is disabled ($wget_file)"; fi;
|
||||
rm "$wget_file"
|
||||
elif [ $(( $(date +%s) - $wget_file_date)) -gt $(( 60*60*24*2 )) ]; then # if file is older than 2 days
|
||||
if $debug; then echo "Deleting file with timestamp $wget_file_date ($wget_file)"; fi;
|
||||
rm "$wget_file"
|
||||
elif [ $(stat --format=%s "$wget_file") -eq 0 ]; then # if file is empty
|
||||
|
|
Loading…
Reference in a new issue