diff --git a/oxdbarchive/cron.py b/oxdbarchive/cron.py index fa5aa98..33747e4 100644 --- a/oxdbarchive/cron.py +++ b/oxdbarchive/cron.py @@ -12,6 +12,10 @@ def extractNew(): for f in ArchiveFile.select(ArchiveFile.q.extracted == False): f.extractAll() +def cleanScrapeitCache(): + #remove files older than 30 days from scrapeit cache + os.system("""find /var/cache/scrapeit/ -type f -ctime +30 -exec rm '{}' \;""") + def cleanClipMovieCache(): cache = os.path.abspath('oxdb/cache/mini/') diff --git a/oxdbarchive/subtitles.py b/oxdbarchive/subtitles.py index 3a74d60..c64c79f 100644 --- a/oxdbarchive/subtitles.py +++ b/oxdbarchive/subtitles.py @@ -12,14 +12,14 @@ import chardet img_extension = 'jpg' -def srt2txt(srt, encoding = "latin-1"): +def srt2txt(srt, encoding = "utf-8"): subtitles = srt2dict(srt, encoding) txt = '' for k in sorted([int(k) for k in subtitles.keys()]): txt += "%s\n\n" % subtitles["%s" % k]['text'] return txt.strip() -def srt2dict(srt, encoding = "latin-1"): +def srt2dict(srt, encoding = "utf-8"): '''convert srt string into a dict in the form dict(num = dict(start, stop, text)) ''' @@ -39,7 +39,7 @@ def srt2dict(srt, encoding = "latin-1"): } return subdict -def dict2srt(subtitles, encoding = "latin-1"): +def dict2srt(subtitles, encoding = "utf-8"): '''convert dict in the form dict(num = dict(start, stop, text)) into an srt file '''