1
0

Fix globbing and omit the last.txt file.

This commit is contained in:
Pierre Cazenave 2018-10-08 12:42:28 +01:00
parent fa11d33a3e
commit 91b12116af

6
dl.py
View File

@ -58,8 +58,10 @@ if __name__ == '__main__':
if args.retain is not None:
# Find the videos in this directory which are older than the time
# stamp since the last run and remove them.
keeptime = datetime.fromtimestamp(ftime) - relativedelta(days=float(args.retain))
for video in Path('.').glob('*.mp4'):
keep_time = datetime.fromtimestamp(script_time) - relativedelta(days=float(args.retain))
for video in Path('.').glob('**/*.*'):
if 'last.txt' in str(video):
continue
modified_time = datetime.utcfromtimestamp(os.path.getmtime(video))
if modified_time < keep_time:
print(f'Removing {str(video)}.')