diff --git a/pandora/item/models.py b/pandora/item/models.py index 777ef9539..3c13c0b4b 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1412,7 +1412,9 @@ class Item(models.Model): self.clear_poster_cache(self.poster.path) self.poster.delete() - def clear_poster_cache(self, poster): + def clear_poster_cache(self, poster=None): + if poster is None: + poster = self.poster.path for f in glob(poster.replace('.jpg', '*.jpg')): if f != poster: try: diff --git a/pandora/item/views.py b/pandora/item/views.py index 15ca45bdd..2c4f32db4 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -673,8 +673,8 @@ def setPoster(request, data): valid_sources = [p['source'] for p in item.get_posters()] if data['source'] in valid_sources: item.poster_source = data['source'] - if item.poster: - item.poster.delete() + item.remove_poster() + item.clear_poster_cache(item.path('siteposter.jpg')) item.save() tasks.update_poster(item.public_id) response = json_response()