Changes to engine file extensions structure

This commit is contained in:
Brett Williams
2024-08-03 20:21:26 -05:00
parent ebb847b09e
commit 7986960b21
5 changed files with 23 additions and 17 deletions

View File

@@ -9,7 +9,7 @@ logger = logging.getLogger()
class AERender(BaseRenderEngine):
supported_extensions = ['.aep']
file_extensions = ['aep']
def version(self):
version = None
@@ -35,4 +35,9 @@ class AERender(BaseRenderEngine):
@classmethod
def get_output_formats(cls):
# todo: create implementation
return []
return []
if __name__ == "__main__":
x = AERender().supported_extensions()
print(x)

View File

@@ -22,7 +22,6 @@ def aerender_path():
class AERenderWorker(BaseRenderWorker):
supported_extensions = ['.aep']
engine = AERender
def __init__(self, input_path, output_path, args=None, parent=None, name=None):

View File

@@ -11,6 +11,7 @@ class Blender(BaseRenderEngine):
install_paths = ['/Applications/Blender.app/Contents/MacOS/Blender']
binary_names = {'linux': 'blender', 'windows': 'blender.exe', 'macos': 'Blender'}
file_extensions = ['blend']
@staticmethod
def downloader():
@@ -26,10 +27,6 @@ class Blender(BaseRenderEngine):
from src.engines.blender.blender_ui import BlenderUI
return BlenderUI.get_options(self)
@staticmethod
def supported_extensions():
return ['blend']
def version(self):
version = None
try:

View File

@@ -9,7 +9,7 @@ SUBPROCESS_TIMEOUT = 5
class BaseRenderEngine(object):
install_paths = []
supported_extensions = []
file_extensions = []
def __init__(self, custom_path=None):
self.custom_renderer_path = custom_path
@@ -58,8 +58,7 @@ class BaseRenderEngine(object):
path = self.renderer_path()
if not path:
raise FileNotFoundError("renderer path not found")
help_doc = subprocess.check_output([path, '-h'], stderr=subprocess.STDOUT,
timeout=SUBPROCESS_TIMEOUT).decode('utf-8')
help_doc = subprocess.run([path, '-h'], capture_output=True, text=True).stdout.strip()
return help_doc
def get_project_info(self, project_path, timeout=10):
@@ -69,6 +68,10 @@ class BaseRenderEngine(object):
def get_output_formats(cls):
raise NotImplementedError(f"get_output_formats not implemented for {cls.__name__}")
@classmethod
def supported_extensions(cls):
return cls.file_extensions
def get_arguments(self):
pass

View File

@@ -23,13 +23,15 @@ class FFMPEG(BaseRenderEngine):
@classmethod
def supported_extensions(cls):
help_text = (subprocess.check_output([cls().renderer_path(), '-h', 'full'], stderr=subprocess.STDOUT)
.decode('utf-8'))
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(','))
return list(found_extensions)
if not cls.file_extensions:
help_text = (subprocess.check_output([cls().renderer_path(), '-h', 'full'], stderr=subprocess.STDOUT)
.decode('utf-8'))
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(','))
cls.file_extensions = list(found_extensions)
return cls.file_extensions
def version(self):
version = None