setPoster

This commit is contained in:
j 2011-08-01 18:55:18 +02:00
parent 8639f6322e
commit a80f1f9515
5 changed files with 6 additions and 4 deletions

View file

@ -813,7 +813,7 @@ class Item(models.Model):
def make_poster(self, force=False): def make_poster(self, force=False):
posters = glob(os.path.abspath(os.path.join(settings.MEDIA_ROOT, posters = glob(os.path.abspath(os.path.join(settings.MEDIA_ROOT,
self.path('poster.*.jpg')))) 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) os.unlink(f)
if not self.poster or force: if not self.poster or force:
url = self.prefered_poster_url() url = self.prefered_poster_url()

View file

@ -479,7 +479,7 @@ def setPoster(request): #parse path and return info
if item.poster: if item.poster:
item.poster.delete() item.poster.delete()
item.save() item.save()
tasks.update_poster.delay(item.itemId) tasks.update_poster(item.itemId)
response = json_response() response = json_response()
response['data']['poster'] = item.get_poster() response['data']['poster'] = item.get_poster()
else: else:

View file

@ -439,6 +439,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
pandora.$ui.mainMenu.disableItem('openmovie'); pandora.$ui.mainMenu.disableItem('openmovie');
} }
if (data.ids.length == 1) { if (data.ids.length == 1) {
pandora.user.ui.listItem = data.ids[0];
pandora.api.get({id: data.ids[0], keys:['stream']}, function(result) { pandora.api.get({id: data.ids[0], keys:['stream']}, function(result) {
pandora.user.infoRatio = result.data.stream.aspectRatio; pandora.user.infoRatio = result.data.stream.aspectRatio;
var height = pandora.$ui.info.width() / pandora.user.infoRatio + 16; var height = pandora.$ui.info.width() / pandora.user.infoRatio + 16;

View file

@ -406,7 +406,8 @@ pandora.ui.mainMenu = function() {
pandora.$ui.accountDialog = (pandora.user.level == 'guest' ? pandora.$ui.accountDialog = (pandora.user.level == 'guest' ?
pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open(); pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open();
} else if (data.id == 'posters') { } 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') { } else if (data.id == 'places') {
pandora.$ui.placesDialog = pandora.ui.placesDialog().open(); pandora.$ui.placesDialog = pandora.ui.placesDialog().open();
/* /*

View file

@ -95,7 +95,7 @@ pandora.ui.postersDialog = function(id) {
}) })
); );
pandora.api.setPoster({ pandora.api.setPoster({
id: pandora.user.ui.item, id: id,
source: source source: source
}); });
} }