This commit is contained in:
j 2011-08-19 14:20:30 +02:00
parent 5366941bc1
commit f3431fa000
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)
return t
data['trivia'] = [fix_links(t) for t in data['trivia']]
if 'aspectratio' in data:
data['aspectRatio'] = data.pop('aspectratio')
#filter reviews
self.external_data = data
self.save()
@ -318,13 +319,6 @@ class Item(models.Model):
other.save()
#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):
url = self.prefered_poster_url()
index = []
@ -433,12 +427,14 @@ class Item(models.Model):
if 'cast' in i and isinstance(i['cast'][0], list):
i['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, i['cast'])
if not keys or 'poster' in keys:
i['poster'] = self.get_poster()
if not keys or 'posterRatio' in keys:
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['apsectRatio'] = i.get('aspectratio')
if streams:
i['videoRatio'] = streams[0].aspect_ratio
#only needed by admins
if keys and 'posters' in keys:

View file

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