diff options
| author | tassaron | 2017-07-02 14:19:15 -0400 |
|---|---|---|
| committer | tassaron | 2017-07-02 14:19:15 -0400 |
| commit | 38557f29f91b8abc68ec3408ce466ee8a5da815e (patch) | |
| tree | 9018c2357645aca9fd5296cfa75bf9ed0cf297ee /src/core.py | |
| parent | 0a9002b42cbfa51fb826868a215202c83c97c330 (diff) | |
rm unneeded imports, work on freezing
Diffstat (limited to 'src/core.py')
| -rw-r--r-- | src/core.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/core.py b/src/core.py index b3c5640..3fa67db 100644 --- a/src/core.py +++ b/src/core.py @@ -17,7 +17,6 @@ import string class Core(): def __init__(self): - self.FFMPEG_BIN = self.findFfmpeg() self.dataDir = QStandardPaths.writableLocation( QStandardPaths.AppConfigLocation ) @@ -63,6 +62,7 @@ class Core(): '*.xpm', ]) + self.FFMPEG_BIN = self.findFfmpeg() self.findComponents() self.selectedComponents = [] # copies of named presets to detect modification @@ -437,15 +437,23 @@ class Core(): self.encoder_options = json.load(json_file) def findFfmpeg(self): - if sys.platform == "win32": - return "ffmpeg.exe" + if getattr(sys, 'frozen', False): + # The application is frozen + if sys.platform == "win32": + return os.path.join(self.wd, 'ffmpeg.exe') + else: + return os.path.join(self.wd, 'ffmpeg') + else: - try: - with open(os.devnull, "w") as f: - sp.check_call(['ffmpeg', '-version'], stdout=f, stderr=f) - return "ffmpeg" - except: - return "avconv" + if sys.platform == "win32": + return "ffmpeg.exe" + else: + try: + with open(os.devnull, "w") as f: + sp.check_call(['ffmpeg', '-version'], stdout=f, stderr=f) + return "ffmpeg" + except: + return "avconv" def readAudioFile(self, filename, parent): command = [self.FFMPEG_BIN, '-i', filename] |
