From 32375a9ff93a20b290fb91da02f224e2a5afafe8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 6 Sep 2010 22:31:12 +0200 Subject: [PATCH] api_api/update poster width/height --- pandora/backend/models.py | 4 ++++ pandora/backend/views.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/pandora/backend/models.py b/pandora/backend/models.py index 41edfa57..30a4ff10 100644 --- a/pandora/backend/models.py +++ b/pandora/backend/models.py @@ -161,6 +161,10 @@ class Movie(models.Model): if not self.oxdbId: self.oxdbId = self.oxid() + if self.poster: + self.poster_height = self.poster.height + self.poster_width = self.poster.width + super(Movie, self).save(*args, **kwargs) self.updateFind() self.updateSort() diff --git a/pandora/backend/views.py b/pandora/backend/views.py index 7ca3a102..29f98f52 100644 --- a/pandora/backend/views.py +++ b/pandora/backend/views.py @@ -60,6 +60,17 @@ def api(request): response['Access-Control-Allow-Origin'] = '*' return response +def api_api(request): + ''' + returns list of all known api action + return {'status': {'code': int, 'text': string}, + 'data': {actions: ['api', 'hello', ...]}} + ''' + actions = globals().keys() + actions = map(lambda a: a[4:], filter(lambda a: a.startswith('api_'), actions)) + actions.sort() + return render_to_json_response(json_response({'actions': actions})) + def api_hello(request): ''' return {'status': {'code': int, 'text': string},