clear siteposter cache too

This commit is contained in:
j 2016-10-28 17:56:39 +02:00
parent 5488eaf223
commit c19598c4d7
2 changed files with 5 additions and 3 deletions

View File

@ -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:

View File

@ -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()