mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Dynamic engine options in UI for blender / ffmpeg (#66)
* Make sure progress UI updates occur on main thread * Cleanup unnecessary code in FFMPEG * Cleanup extension matching * Make sure supported_extensions is now called as a method everywhere * Fix add_job crashing * Update the renderer to reflect the current file type * Sort engine versions from newest to oldest * Consolidate Project Group and Server Group * Split UI options into its own file for easier updating * Add ffmpeg ui stem
This commit is contained in:
@@ -18,6 +18,20 @@ class FFMPEG(BaseRenderEngine):
|
||||
from src.engines.ffmpeg.ffmpeg_worker import FFMPEGRenderWorker
|
||||
return FFMPEGRenderWorker
|
||||
|
||||
def ui_options(self):
|
||||
from src.engines.ffmpeg.ffmpeg_ui import FFMPEGUI
|
||||
return FFMPEGUI.get_options(self)
|
||||
|
||||
@classmethod
|
||||
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_extensions = set()
|
||||
for match in found:
|
||||
found_extensions.update(match.split(','))
|
||||
return list(found_extensions)
|
||||
|
||||
def version(self):
|
||||
version = None
|
||||
try:
|
||||
@@ -31,15 +45,11 @@ class FFMPEG(BaseRenderEngine):
|
||||
return version
|
||||
|
||||
def get_project_info(self, project_path, timeout=10):
|
||||
return self.get_video_info_ffprobe(project_path)
|
||||
|
||||
@staticmethod
|
||||
def get_video_info_ffprobe(video_path):
|
||||
try:
|
||||
# Run ffprobe and parse the output as JSON
|
||||
cmd = [
|
||||
'ffprobe', '-v', 'quiet', '-print_format', 'json',
|
||||
'-show_streams', '-select_streams', 'v', video_path
|
||||
'-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)
|
||||
@@ -85,7 +95,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>.*)\r'
|
||||
pattern = '(?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:
|
||||
@@ -105,7 +115,7 @@ class FFMPEG(BaseRenderEngine):
|
||||
return found_extensions
|
||||
|
||||
def get_output_formats(self):
|
||||
return [x for x in self.get_all_formats() if 'E' in x['type'].upper()]
|
||||
return [x['id'] for x in self.get_all_formats() if 'E' in x['type'].upper()]
|
||||
|
||||
def get_frame_count(self, path_to_file):
|
||||
raw_stdout = subprocess.check_output([self.renderer_path(), '-i', path_to_file, '-map', '0:v:0', '-c', 'copy',
|
||||
@@ -117,7 +127,8 @@ class FFMPEG(BaseRenderEngine):
|
||||
return frame_number
|
||||
|
||||
def get_arguments(self):
|
||||
help_text = subprocess.check_output([self.renderer_path(), '-h', 'long'], stderr=subprocess.STDOUT).decode('utf-8')
|
||||
help_text = (subprocess.check_output([self.renderer_path(), '-h', 'long'], stderr=subprocess.STDOUT)
|
||||
.decode('utf-8'))
|
||||
lines = help_text.splitlines()
|
||||
|
||||
options = {}
|
||||
|
||||
Reference in New Issue
Block a user