use display_aspect_ratio of stream if set
This commit is contained in:
parent
09a84d8ad9
commit
ffd256ca93
1 changed files with 5 additions and 1 deletions
|
@ -477,7 +477,11 @@ class Stream(models.Model):
|
||||||
self.oshash = self.info.get('oshash')
|
self.oshash = self.info.get('oshash')
|
||||||
self.duration = self.info.get('duration', 0)
|
self.duration = self.info.get('duration', 0)
|
||||||
if 'video' in self.info and self.info['video']:
|
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:
|
else:
|
||||||
self.aspect_ratio = 128/80
|
self.aspect_ratio = 128/80
|
||||||
super(Stream, self).save(*args, **kwargs)
|
super(Stream, self).save(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue