This commit is contained in:
j 2011-08-19 14:20:30 +02:00
parent 52ad295485
commit 1d64c89fdd
2 changed files with 9 additions and 13 deletions

View file

@ -238,7 +238,8 @@ class Item(models.Model):
t = re.sub('<a href="(/title/.*?/)">(.*?)</a>', fix_titles, t) t = re.sub('<a href="(/title/.*?/)">(.*?)</a>', fix_titles, t)
return t return t
data['trivia'] = [fix_links(t) for t in data['trivia']] data['trivia'] = [fix_links(t) for t in data['trivia']]
if 'aspectratio' in data:
data['aspectRatio'] = data.pop('aspectratio')
#filter reviews #filter reviews
self.external_data = data self.external_data = data
self.save() self.save()
@ -318,13 +319,6 @@ class Item(models.Model):
other.save() other.save()
#FIXME: update poster, stills and streams after this #FIXME: update poster, stills and streams after this
def get_poster(self):
poster = {}
poster['width'] = self.poster_width
poster['height'] = self.poster_height
poster['url'] = '/%s/poster.jpg' % self.itemId
return poster
def get_posters(self): def get_posters(self):
url = self.prefered_poster_url() url = self.prefered_poster_url()
index = [] index = []
@ -433,12 +427,14 @@ class Item(models.Model):
if 'cast' in i and isinstance(i['cast'][0], list): if 'cast' in i and isinstance(i['cast'][0], list):
i['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, i['cast']) i['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, i['cast'])
if not keys or 'poster' in keys: if not keys or 'posterRatio' in keys:
i['poster'] = self.get_poster() i['posterRatio'] = self.poster_width / self.poster_height
i['durations'] = [s.duration for s in self.streams()] streams = self.streams()
i['durations'] = [s.duration for s in streams]
i['duration'] = sum(i['durations']) i['duration'] = sum(i['durations'])
i['apsectRatio'] = i.get('aspectratio') if streams:
i['videoRatio'] = streams[0].aspect_ratio
#only needed by admins #only needed by admins
if keys and 'posters' in keys: if keys and 'posters' in keys:

View file

@ -484,7 +484,7 @@ def setPoster(request): #parse path and return info
item.save() item.save()
tasks.update_poster(item.itemId) tasks.update_poster(item.itemId)
response = json_response() response = json_response()
response['data']['poster'] = item.get_poster() response['data']['posterAspect'] = item.poster_width/item.poster_height
else: else:
response = json_response(status=403, text='invalid poster url') response = json_response(status=403, text='invalid poster url')
else: else: