From f0b8824f62872b0bb6b2f4b739c8e3c4ff8291a7 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 13 Jul 2013 13:04:59 +0000 Subject: [PATCH] keep poster service selection even if poster gets updated, fixes #1098 --- pandora/item/models.py | 2 +- pandora/item/tasks.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 508a51f2..80fc049a 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -463,7 +463,7 @@ class Item(models.Model): for service in external_posters: p = external_posters[service][0] p['source'] = service - p['selected'] = p['url'] == url + p['selected'] = self.poster_source and self.poster_source == service or False p['index'] = index.index(service) posters.append(p) posters.sort(key=lambda a: a['index']) diff --git a/pandora/item/tasks.py b/pandora/item/tasks.py index f10f0612..291b166c 100644 --- a/pandora/item/tasks.py +++ b/pandora/item/tasks.py @@ -49,12 +49,13 @@ def update_poster(itemId): item = models.Item.objects.get(itemId=itemId) item.make_poster(True) item.make_icon() - models.Item.objects.filter(pk=item.id).update( - poster=item.poster.name, - poster_height=item.poster.height, - poster_width=item.poster.width, - icon=item.icon.name - ) + if item.poster and os.path.exists(item.poster.path): + models.Item.objects.filter(pk=item.id).update( + poster=item.poster.name, + poster_height=item.poster.height, + poster_width=item.poster.width, + icon=item.icon.name + ) @task(ignore_results=True, queue='default') def update_file_paths(itemId):