mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Pylint cleanup (#74)
* Misc fixes * Misc cleanup * Add all_versions to blender_downloader.py * More cleanup * Fix issue with status not reporting engine info * Misc fixes * Misc cleanup * Add all_versions to blender_downloader.py * More cleanup * Fix issue with status not reporting engine info
This commit is contained in:
@@ -25,7 +25,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
def supported_extensions(cls):
|
||||
help_text = (subprocess.check_output([cls().renderer_path(), '-h', 'full'], stderr=subprocess.STDOUT)
|
||||
.decode('utf-8'))
|
||||
found = re.findall('extensions that .* is allowed to access \(default "(.*)"', help_text)
|
||||
found = re.findall(r'extensions that .* is allowed to access \(default "(.*)"', help_text)
|
||||
found_extensions = set()
|
||||
for match in found:
|
||||
found_extensions.update(match.split(','))
|
||||
@@ -36,7 +36,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
try:
|
||||
ver_out = subprocess.check_output([self.renderer_path(), '-version'],
|
||||
timeout=SUBPROCESS_TIMEOUT).decode('utf-8')
|
||||
match = re.match(".*version\s*([\w.*]+)\W*", ver_out)
|
||||
match = re.match(r".*version\s*([\w.*]+)\W*", ver_out)
|
||||
if match:
|
||||
version = match.groups()[0]
|
||||
except Exception as e:
|
||||
@@ -50,8 +50,8 @@ class FFMPEG(BaseRenderEngine):
|
||||
'ffprobe', '-v', 'quiet', '-print_format', 'json',
|
||||
'-show_streams', '-select_streams', 'v', project_path
|
||||
]
|
||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
video_info = json.loads(result.stdout)
|
||||
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True)
|
||||
video_info = json.loads(output)
|
||||
|
||||
# Extract the necessary information
|
||||
video_stream = video_info['streams'][0]
|
||||
@@ -94,7 +94,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
try:
|
||||
formats_raw = subprocess.check_output([self.renderer_path(), '-formats'], stderr=subprocess.DEVNULL,
|
||||
timeout=SUBPROCESS_TIMEOUT).decode('utf-8')
|
||||
pattern = '(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)'
|
||||
pattern = r'(?P<type>[DE]{1,2})\s+(?P<id>\S{2,})\s+(?P<name>.*)'
|
||||
all_formats = [m.groupdict() for m in re.finditer(pattern, formats_raw)]
|
||||
return all_formats
|
||||
except Exception as e:
|
||||
@@ -124,6 +124,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
if match:
|
||||
frame_number = int(match[-1])
|
||||
return frame_number
|
||||
return -1
|
||||
|
||||
def get_arguments(self):
|
||||
help_text = (subprocess.check_output([self.renderer_path(), '-h', 'long'], stderr=subprocess.STDOUT)
|
||||
@@ -154,4 +155,4 @@ class FFMPEG(BaseRenderEngine):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(FFMPEG().supported_extensions())
|
||||
print(FFMPEG().get_all_formats())
|
||||
|
||||
Reference in New Issue
Block a user