From ffd256ca933646984d35f6164d02724cb1f48748 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 11 Jan 2013 12:48:40 +0530 Subject: [PATCH] use display_aspect_ratio of stream if set --- pandora/archive/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 8398f0bb4..620501a6d 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -477,7 +477,11 @@ class Stream(models.Model): self.oshash = self.info.get('oshash') self.duration = self.info.get('duration', 0) if 'video' in self.info and self.info['video']: - self.aspect_ratio = self.info['video'][0]['width'] / self.info['video'][0]['height'] + if 'display_aspect_ratio' in self.info['video'][0]: + dar = map(int, self.info['video'][0]['display_aspect_ratio'].split(':')) + self.aspect_ratio = dar[0] / dar[1] + else: + self.aspect_ratio = self.info['video'][0]['width'] / self.info['video'][0]['height'] else: self.aspect_ratio = 128/80 super(Stream, self).save(*args, **kwargs)