diff options
| author | tassaron | 2017-07-25 22:02:47 -0400 |
|---|---|---|
| committer | tassaron | 2017-07-25 22:02:47 -0400 |
| commit | 15d70474d4df16cd03f4eb672d409166f793eabf (patch) | |
| tree | 2792cc1b4122a6cd748273b91d14635a049da3d1 /src/components | |
| parent | 661526b0739115594fda4c0e876398cdc940fbe1 (diff) | |
error can be locked within properties()
and simplified the componenterrors again
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/video.py | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/components/video.py b/src/components/video.py index 6b0a04a..8872fbf 100644 --- a/src/components/video.py +++ b/src/components/video.py @@ -154,33 +154,28 @@ class Component(Component): return frame def properties(self): - # TODO: Disallow selecting the same video you're exporting to props = [] - if not self.videoPath or self.badVideo \ - or not os.path.exists(self.videoPath): - return ['error'] + + if not self.videoPath: + self.lockError("There is no video selected.") + elif self.badVideo: + self.lockError("Could not identify an audio stream in this video.") + elif not os.path.exists(self.videoPath): + self.lockError("The video selected does not exist!") + elif (os.path.realpath(self.videoPath) == + os.path.realpath( + self.parent.window.lineEdit_outputFile.text())): + self.lockError("Input and output paths match.") if self.useAudio: props.append('audio') - self.testAudioStream() - if self.badAudio: - return ['error'] + if not testAudioStream(self.videoPath) \ + and self.error() is None: + self.lockError( + "Could not identify an audio stream in this video.") return props - def error(self): - if self.badAudio: - return "Could not identify an audio stream in this video." - if not self.videoPath: - return "There is no video selected." - if not os.path.exists(self.videoPath): - return "The video selected does not exist!" - if self.badVideo: - return "The video selected is corrupt!" - - def testAudioStream(self): - self.badAudio = testAudioStream(self.videoPath) - def audio(self): params = {} if self.volume != 1.0: |
