forked from 0x2620/pandora
sorting
This commit is contained in:
parent
7ca86a952e
commit
a72961e89d
1 changed files with 13 additions and 9 deletions
|
@ -526,6 +526,7 @@ class Item(models.Model):
|
||||||
|
|
||||||
s.country = ','.join(self.get('countries', []))
|
s.country = ','.join(self.get('countries', []))
|
||||||
s.year = self.get('year', '')
|
s.year = self.get('year', '')
|
||||||
|
s.year_desc = s.year
|
||||||
|
|
||||||
for key in self.person_keys:
|
for key in self.person_keys:
|
||||||
setattr(s, key, sortNames(self.get(utils.plural_key(key), [])))
|
setattr(s, key, sortNames(self.get(utils.plural_key(key), [])))
|
||||||
|
@ -549,14 +550,17 @@ class Item(models.Model):
|
||||||
s.wpm = 0 #FIXME
|
s.wpm = 0 #FIXME
|
||||||
s.risk = 0 #FIXME
|
s.risk = 0 #FIXME
|
||||||
# data from related files
|
# data from related files
|
||||||
s.duration = 0 #FIXME
|
videos = self.main_videos()
|
||||||
s.resolution = 0 #FIXME
|
s.duration = sum([v.duration for v in videos])
|
||||||
s.aspectratio = 0 #FIXME
|
s.resolution = videos[0].width * videos[0].height
|
||||||
s.bitrate = 0 #FIXME
|
s.aspectratio = int(1000 * utils.parse_decimal(v.display_aspect_ratio))
|
||||||
s.pixels = 0 #FIXME
|
#FIXME: should be average over all files
|
||||||
s.filename = 0 #FIXME
|
if 'bitrate' in videos[0].info:
|
||||||
s.files = 0 #FIXME
|
s.bitrate = videos[0].info['bitrate']
|
||||||
s.size = 0 #FIXME
|
s.pixels = sum([v.pixels for v in videos])
|
||||||
|
s.filename = ' '.join([v.name for v in videos])
|
||||||
|
s.files = self.files.all().count()
|
||||||
|
s.size = sum([v.size for v in videos]) #FIXME: only size of movies?
|
||||||
|
|
||||||
for key in ('title', 'language', 'country') + self.person_keys:
|
for key in ('title', 'language', 'country') + self.person_keys:
|
||||||
setattr(s, '%s_desc'%key, getattr(s, key))
|
setattr(s, '%s_desc'%key, getattr(s, key))
|
||||||
|
@ -805,7 +809,7 @@ class ItemSort(models.Model):
|
||||||
itemId = models.CharField('ID', max_length=128, blank=True, db_index=True)
|
itemId = models.CharField('ID', max_length=128, blank=True, db_index=True)
|
||||||
|
|
||||||
duration = models.FloatField(default=-1, db_index=True)
|
duration = models.FloatField(default=-1, db_index=True)
|
||||||
resolution = models.IntegerField(blank=True, db_index=True)
|
resolution = models.BigIntegerField(blank=True, db_index=True)
|
||||||
aspectratio = models.IntegerField('Aspect Ratio', blank=True, db_index=True)
|
aspectratio = models.IntegerField('Aspect Ratio', blank=True, db_index=True)
|
||||||
bitrate = models.IntegerField(blank=True, db_index=True)
|
bitrate = models.IntegerField(blank=True, db_index=True)
|
||||||
pixels = models.BigIntegerField(blank=True, db_index=True)
|
pixels = models.BigIntegerField(blank=True, db_index=True)
|
||||||
|
|
Loading…
Reference in a new issue