From df0c24628c585d01b76412d4ffdb76068b0be9e8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 29 Jul 2014 18:37:01 +0200 Subject: [PATCH] really fix #2442 --- pandora/archive/models.py | 10 +--------- pandora/archive/tasks.py | 5 +++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index f9fefb0d..3962e4bb 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -636,20 +636,12 @@ class Stream(models.Model): for f in config['formats']: derivative, created = Stream.objects.get_or_create(file=self.file, resolution=resolution, format=f) - - name = derivative.name() - name = os.path.join(os.path.dirname(self.media.name), name) if created: derivative.source = self derivative.save() - derivative.media.name = name derivative.encode() - derivative.save() elif rebuild or not derivative.available: - if not derivative.media: - derivative.media.name = name derivative.encode() - return True def encode(self): media = self.source.media.path if self.source else self.file.data.path @@ -660,13 +652,13 @@ class Stream(models.Model): if not self.media: self.media.name = self.path(self.name()) target = self.media.path - info = ox.avinfo(media) ok, error = extract.stream(media, target, self.name(), info, ffmpeg) # file could have been moved while encoding # get current version from db and update _self = Stream.objects.get(id=self.id) _self.update_status(ok, error) + return _self def update_status(self, ok, error): if ok: diff --git a/pandora/archive/tasks.py b/pandora/archive/tasks.py index 03624674..3c89873c 100644 --- a/pandora/archive/tasks.py +++ b/pandora/archive/tasks.py @@ -130,11 +130,12 @@ def extract_stream(fileId): ) if created: stream.media.name = stream.path(stream.name()) - stream.encode() + stream = stream.encode() if stream.available: stream.make_timeline() stream.extract_derivatives() - file.item.update_selected() + # get current version from db + file = models.File.objects.get(id=fileId) if not file.item.rendered: file.item.update_timeline() if file.item.rendered: