Streamline is_media_file

This commit is contained in:
Labrys of Knossos 2019-01-06 10:03:27 -05:00
commit 4424e21786

View file

@ -45,14 +45,14 @@ def is_media_file(mediafile, media=True, audio=True, meta=True, archives=True, o
return False return False
except Exception: except Exception:
pass pass
if (media and file_ext.lower() in core.MEDIACONTAINER) \
or (audio and file_ext.lower() in core.AUDIOCONTAINER) \ return any([
or (meta and file_ext.lower() in core.METACONTAINER) \ (media and file_ext.lower() in core.MEDIACONTAINER),
or (archives and is_archive_file(mediafile)) \ (audio and file_ext.lower() in core.AUDIOCONTAINER),
or (other and (file_ext.lower() in otherext or 'all' in otherext)): (meta and file_ext.lower() in core.METACONTAINER),
return True (archives and is_archive_file(mediafile)),
else: (other and (file_ext.lower() in otherext or 'all' in otherext)),
return False ])
def list_media_files(path, min_size=0, delete_ignored=0, media=True, audio=True, meta=True, archives=True, other=False, otherext=None): def list_media_files(path, min_size=0, delete_ignored=0, media=True, audio=True, meta=True, archives=True, other=False, otherext=None):