From 4b27ab07ebc8ec17f7526081fab017fda1dfffe2 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 21 May 2020 16:41:01 +0200 Subject: [PATCH 1/1] Fixes --- src/archive/tasks.py | 7 +------ src/youtube/models.py | 7 ++----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/archive/tasks.py b/src/archive/tasks.py index b5675ce..45ae9c1 100644 --- a/src/archive/tasks.py +++ b/src/archive/tasks.py @@ -93,13 +93,8 @@ class AudioFormatTask(Task): user = User.objects.get(id=uid) - try: + if not os.path.exists(BUILD_PATH): os.makedirs(BUILD_PATH) - except OSError as e: - if e.errno == errno.EEXIST: - pass - else: - raise out_file = NamedTemporaryFile(delete=False, prefix='%d-' % aid, suffix='.%s' % self.ext, dir=BUILD_PATH) out_file.close() diff --git a/src/youtube/models.py b/src/youtube/models.py index f0ecc6c..eb669e0 100644 --- a/src/youtube/models.py +++ b/src/youtube/models.py @@ -119,16 +119,13 @@ class YouTube(models.Model): def prepare_audio(self, input_path): files = [] - delete = [] if self.intro_flac: files.append(standardize_audio(self.intro_flac.path)) - delete.append(files[-1]) - files.append(input_path) + files.append(standardize_audio(input_path, cache=False)) if self.outro_flac: files.append(standardize_audio(self.outro_flac.path)) - delete.append(files[-1]) output = concat_audio(files) - for d in delete: + for d in files: unlink(d) return output -- 2.20.1