From a80f1f951597e83def31f3fcd54a6d0ca364c0eb Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 1 Aug 2011 18:55:18 +0200 Subject: [PATCH] setPoster --- pandora/item/models.py | 2 +- pandora/item/views.py | 2 +- static/js/pandora/ui/list.js | 1 + static/js/pandora/ui/menu.js | 3 ++- static/js/pandora/ui/postersDialog.js | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 0e944d72..a1be0d10 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -813,7 +813,7 @@ class Item(models.Model): def make_poster(self, force=False): posters = glob(os.path.abspath(os.path.join(settings.MEDIA_ROOT, self.path('poster.*.jpg')))) - for f in filter(posters, lambda p: not p.endswith('poster.local.jpg')): + for f in filter(lambda p: not p.endswith('poster.local.jpg'), posters): os.unlink(f) if not self.poster or force: url = self.prefered_poster_url() diff --git a/pandora/item/views.py b/pandora/item/views.py index b8e042e4..5dd0713e 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -479,7 +479,7 @@ def setPoster(request): #parse path and return info if item.poster: item.poster.delete() item.save() - tasks.update_poster.delay(item.itemId) + tasks.update_poster(item.itemId) response = json_response() response['data']['poster'] = item.get_poster() else: diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index abd08048..442bfdbb 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -439,6 +439,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument pandora.$ui.mainMenu.disableItem('openmovie'); } if (data.ids.length == 1) { + pandora.user.ui.listItem = data.ids[0]; pandora.api.get({id: data.ids[0], keys:['stream']}, function(result) { pandora.user.infoRatio = result.data.stream.aspectRatio; var height = pandora.$ui.info.width() / pandora.user.infoRatio + 16; diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index 2fc9de97..34e43933 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -406,7 +406,8 @@ pandora.ui.mainMenu = function() { pandora.$ui.accountDialog = (pandora.user.level == 'guest' ? pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open(); } else if (data.id == 'posters') { - pandora.$ui.postersDialog = pandora.ui.postersDialog(pandora.user.ui.item).open(); + var id = pandora.user.ui.item || pandora.user.ui.listItem; + pandora.$ui.postersDialog = pandora.ui.postersDialog(id).open(); } else if (data.id == 'places') { pandora.$ui.placesDialog = pandora.ui.placesDialog().open(); /* diff --git a/static/js/pandora/ui/postersDialog.js b/static/js/pandora/ui/postersDialog.js index 31596eac..0cac0a46 100644 --- a/static/js/pandora/ui/postersDialog.js +++ b/static/js/pandora/ui/postersDialog.js @@ -95,7 +95,7 @@ pandora.ui.postersDialog = function(id) { }) ); pandora.api.setPoster({ - id: pandora.user.ui.item, + id: id, source: source }); }