Update subgen.py

This commit is contained in:
McCloudS
2024-08-12 14:05:35 -06:00
committed by GitHub
parent 9c4956a559
commit 9c9e447cc7

View File

@@ -780,13 +780,16 @@ def get_jellyfin_admin(users):
def has_audio(file_path): def has_audio(file_path):
try: try:
with av.open(file_path) as container:
if has_image_extension(file_path): if has_image_extension(file_path):
logging.debug("{file_path} is an image, skipping processing")
return False return False
with av.open(file_path) as container:
return any(stream.type == 'audio' for stream in container.streams) return any(stream.type == 'audio' for stream in container.streams)
except (av.AVError, UnicodeDecodeError): except (av.AVError, UnicodeDecodeError):
return False return False
def path_mapping(fullpath): def path_mapping(fullpath):
if use_path_mapping: if use_path_mapping:
logging.debug("Updated path: " + fullpath.replace(path_mapping_from, path_mapping_to)) logging.debug("Updated path: " + fullpath.replace(path_mapping_from, path_mapping_to))