mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Better error handling for ffmpeg.get_all_formats()
This commit is contained in:
@@ -33,11 +33,15 @@ class FFMPEG(BaseRenderEngine):
|
|||||||
return encoders
|
return encoders
|
||||||
|
|
||||||
def get_all_formats(self):
|
def get_all_formats(self):
|
||||||
formats_raw = subprocess.check_output([self.renderer_path(), '-formats'], stderr=subprocess.DEVNULL,
|
try:
|
||||||
timeout=SUBPROCESS_TIMEOUT).decode('utf-8')
|
formats_raw = subprocess.check_output([self.renderer_path(), '-formats'], stderr=subprocess.DEVNULL,
|
||||||
pattern = '(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)'
|
timeout=SUBPROCESS_TIMEOUT).decode('utf-8')
|
||||||
all_formats = [m.groupdict() for m in re.finditer(pattern, formats_raw)]
|
pattern = '(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)\r'
|
||||||
return all_formats
|
all_formats = [m.groupdict() for m in re.finditer(pattern, formats_raw)]
|
||||||
|
return all_formats
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error getting all formats: {e}")
|
||||||
|
return []
|
||||||
|
|
||||||
def extension_for_format(self, ffmpeg_format):
|
def extension_for_format(self, ffmpeg_format):
|
||||||
# Extract the common extension using regex
|
# Extract the common extension using regex
|
||||||
|
|||||||
Reference in New Issue
Block a user