From 1330646d52d099c0836fdc8ec223e31511993f0d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 6 Sep 2010 22:45:11 +0200 Subject: [PATCH] return poster object --- pandora/backend/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandora/backend/models.py b/pandora/backend/models.py index 30a4ff107..544929b23 100644 --- a/pandora/backend/models.py +++ b/pandora/backend/models.py @@ -197,6 +197,16 @@ class Movie(models.Model): 'poster_width': 'posterWidth', 'poster_height': 'posterHeight' } + def poster_json(self): + poster = {} + poster['width'] = self.poster_width + poster['height'] = self.poster_height + if self.poster: + poster['url'] = self.poster.url + else: + poster['url'] = self.poster_url + return poster + def get_json(self, fields=None): movie = {} for key in self._public_fields: @@ -213,6 +223,7 @@ class Movie(models.Model): if not fields: movie['poster'] = self.get_poster() movie['stream'] = self.get_stream() + movie['poster'] = self.poster_json() if fields: for f in fields: if f.endswith('.length') and f[:-7] in ('cast', 'genre', 'trivia'):