From 28aadd6a43841a08e404dc3e42f6d9c3ef291ef0 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 14 Dec 2012 15:05:37 +0100 Subject: [PATCH] make sure derivative name is set before encoding --- pandora/archive/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index b153ad06..8398f0bb 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -437,14 +437,18 @@ 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.video.name), name) if created: derivative.source = self derivative.save() - name = derivative.name() - derivative.video.name = os.path.join(os.path.dirname(self.video.name), name) + derivative.video.name = name derivative.encode() derivative.save() elif rebuild or not derivative.available: + if not derivative.video: + derivative.video.name = name derivative.encode() return True