keep poster service selection even if poster gets updated, fixes #1098

This commit is contained in:
j 2013-07-13 13:04:59 +00:00
parent 2473dfd231
commit f0b8824f62
2 changed files with 8 additions and 7 deletions

View file

@ -463,7 +463,7 @@ class Item(models.Model):
for service in external_posters: for service in external_posters:
p = external_posters[service][0] p = external_posters[service][0]
p['source'] = service 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) p['index'] = index.index(service)
posters.append(p) posters.append(p)
posters.sort(key=lambda a: a['index']) posters.sort(key=lambda a: a['index'])

View file

@ -49,12 +49,13 @@ def update_poster(itemId):
item = models.Item.objects.get(itemId=itemId) item = models.Item.objects.get(itemId=itemId)
item.make_poster(True) item.make_poster(True)
item.make_icon() item.make_icon()
models.Item.objects.filter(pk=item.id).update( if item.poster and os.path.exists(item.poster.path):
poster=item.poster.name, models.Item.objects.filter(pk=item.id).update(
poster_height=item.poster.height, poster=item.poster.name,
poster_width=item.poster.width, poster_height=item.poster.height,
icon=item.icon.name poster_width=item.poster.width,
) icon=item.icon.name
)
@task(ignore_results=True, queue='default') @task(ignore_results=True, queue='default')
def update_file_paths(itemId): def update_file_paths(itemId):