From 38557f29f91b8abc68ec3408ce466ee8a5da815e Mon Sep 17 00:00:00 2001 From: tassaron Date: Sun, 2 Jul 2017 14:19:15 -0400 Subject: rm unneeded imports, work on freezing --- src/core.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/core.py') 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] -- cgit v1.2.3