From a2838a0c3898f999e71f76e6e8d5691155438aea Mon Sep 17 00:00:00 2001 From: tassaron Date: Sun, 25 Jun 2017 10:36:32 -0400 Subject: disable some hotkeys while encoding, more friendly error messages --- src/components/video.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/components/video.py') diff --git a/src/components/video.py b/src/components/video.py index 3e87d2e..44f88a5 100644 --- a/src/components/video.py +++ b/src/components/video.py @@ -86,12 +86,14 @@ class Video: continue except AttributeError as e: self.parent.showMessage( - msg='%s couldn\'t be loaded.' % os.path.basename( + msg='%s couldn\'t be loaded. ' + 'This is a fatal error.' % os.path.basename( self.videoPath ), detail=str(e) ) self.parent.stopVideo() + break self.currentFrame = pipe.stdout.read(self.chunkSize) if len(self.currentFrame) != 0: @@ -258,20 +260,24 @@ def scale(scale, width, height, returntype=None): def finalizeFrame(self, imageData, width, height): - if self.distort: - try: + try: + if self.distort: image = Image.frombytes( 'RGBA', (width, height), imageData) - except ValueError: - print('#### ignored invalid data caused by distortion ####') - image = self.blankFrame(width, height) - else: - image = Image.frombytes( - 'RGBA', - scale(self.scale, width, height, int), - imageData) + else: + image = Image.frombytes( + 'RGBA', + scale(self.scale, width, height, int), + imageData) + + except ValueError: + print( + '### BAD VIDEO SELECTED ###\n' + 'Video will not export with these settings' + ) + return self.blankFrame(width, height) if self.scale != 100 \ or self.xPosition != 0 or self.yPosition != 0: -- cgit v1.2.3