Better output on dryrun, make clear what we would delete now
This commit is contained in:
parent
a00ffc258f
commit
36d392e9b1
11
cleanmedia
11
cleanmedia
@ -151,7 +151,7 @@ def parse_options():
|
||||
logging.basicConfig(level=loglevel, format= '%(levelname)s - %(message)s')
|
||||
return args
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
args = parse_options()
|
||||
(MEDIA_PATH, CONN_STR) = read_config(args.config)
|
||||
@ -160,7 +160,10 @@ if __name__ == '__main__':
|
||||
files = mr.get_remote_media()
|
||||
for file in files:
|
||||
if file.create_date < cleantime:
|
||||
if not file.exists():
|
||||
logging.info(f"file id {file.media_id} does not physically exist (path {file.fullpath})")
|
||||
if not args.dryrun:
|
||||
if args.dryrun: # the great pretender
|
||||
if file.exists():
|
||||
logging.info(f"Pretending to delete file id {file.media_id} on path {file.fullpath}.")
|
||||
else:
|
||||
logging.info(f"file id {file.media_id} does not physically exist (path {file.fullpath})")
|
||||
else:
|
||||
file.delete()
|
||||
|
Loading…
x
Reference in New Issue
Block a user