From d38109453cea17a31c335837c0029ad51fa3dda1 Mon Sep 17 00:00:00 2001 From: tassaron Date: Sun, 23 Jul 2017 17:14:21 -0400 Subject: better component error messages fatal errors cancel the export instead of crashing --- src/components/original.py | 2 +- src/components/sound.py | 2 ++ src/components/video.py | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/components') diff --git a/src/components/original.py b/src/components/original.py index 2bda878..570465d 100644 --- a/src/components/original.py +++ b/src/components/original.py @@ -15,7 +15,7 @@ class Component(Component): name = 'Classic Visualizer' version = '1.0.0' - def names(): + def names(*args): return ['Original Audio Visualization'] def widget(self, *args): diff --git a/src/components/sound.py b/src/components/sound.py index dd3cbab..b3a627a 100644 --- a/src/components/sound.py +++ b/src/components/sound.py @@ -18,6 +18,8 @@ class Component(Component): 'chorus': self.page.checkBox_chorus, 'delay': self.page.spinBox_delay, 'volume': self.page.spinBox_volume, + }, commandArgs={ + 'sound': None, }) def previewRender(self, previewWorker): diff --git a/src/components/video.py b/src/components/video.py index 677e3ee..d3696d4 100644 --- a/src/components/video.py +++ b/src/components/video.py @@ -14,7 +14,7 @@ from toolkit import openPipe, checkOutput class Video: - '''Video Component Frame-Fetcher''' + '''Opens a pipe to ffmpeg and stores a buffer of raw video frames.''' def __init__(self, **kwargs): mandatoryArgs = [ 'ffmpeg', # path to ffmpeg, usually self.core.FFMPEG_BIN @@ -28,10 +28,7 @@ class Video: 'component', # component object ] for arg in mandatoryArgs: - try: - setattr(self, arg, kwargs[arg]) - except KeyError: - raise BadComponentInit(arg, self.__doc__) + setattr(self, arg, kwargs[arg]) self.frameNo = -1 self.currentFrame = 'None' @@ -196,13 +193,16 @@ class Component(Component): height = int(self.settings.value('outputHeight')) self.blankFrame_ = BlankFrame(width, height) self.updateChunksize(width, height) - self.video = Video( - ffmpeg=self.core.FFMPEG_BIN, videoPath=self.videoPath, - width=width, height=height, chunkSize=self.chunkSize, - frameRate=int(self.settings.value("outputFrameRate")), - parent=self.parent, loopVideo=self.loopVideo, - component=self, scale=self.scale - ) if os.path.exists(self.videoPath) else None + try: + self.video = Video( + ffmpeg=self.core.FFMPEG_BIN, #videoPath=self.videoPath, + width=width, height=height, chunkSize=self.chunkSize, + frameRate=int(self.settings.value("outputFrameRate")), + parent=self.parent, loopVideo=self.loopVideo, + component=self, scale=self.scale + ) if os.path.exists(self.videoPath) else None + except KeyError: + raise BadComponentInit(self, 'Frame Fetcher initialization') def frameRender(self, layerNo, frameNo): if self.video: -- cgit v1.2.3