forked from 0x2620/pandora
always clear siteposter cache if poster is removed
This commit is contained in:
parent
c19598c4d7
commit
addaa56d85
2 changed files with 3 additions and 2 deletions
|
@ -1375,6 +1375,7 @@ class Item(models.Model):
|
||||||
f.write(data)
|
f.write(data)
|
||||||
self.poster_height = self.poster.height
|
self.poster_height = self.poster.height
|
||||||
self.poster_width = self.poster.width
|
self.poster_width = self.poster.width
|
||||||
|
self.clear_poster_cache(self.poster.path)
|
||||||
if self.json.get('posterRatio') != self.poster_width / self.poster_height:
|
if self.json.get('posterRatio') != self.poster_width / self.poster_height:
|
||||||
self.json = self.get_json()
|
self.json = self.get_json()
|
||||||
Item.objects.filter(id=self.id).update(json=self.json,
|
Item.objects.filter(id=self.id).update(json=self.json,
|
||||||
|
@ -1411,6 +1412,7 @@ class Item(models.Model):
|
||||||
if self.poster:
|
if self.poster:
|
||||||
self.clear_poster_cache(self.poster.path)
|
self.clear_poster_cache(self.poster.path)
|
||||||
self.poster.delete()
|
self.poster.delete()
|
||||||
|
self.clear_poster_cache(os.path.join(settings.MEDIA_ROOT, self.path('siteposter.jpg')))
|
||||||
|
|
||||||
def clear_poster_cache(self, poster=None):
|
def clear_poster_cache(self, poster=None):
|
||||||
if poster is None:
|
if poster is None:
|
||||||
|
|
|
@ -674,7 +674,6 @@ def setPoster(request, data):
|
||||||
if data['source'] in valid_sources:
|
if data['source'] in valid_sources:
|
||||||
item.poster_source = data['source']
|
item.poster_source = data['source']
|
||||||
item.remove_poster()
|
item.remove_poster()
|
||||||
item.clear_poster_cache(item.path('siteposter.jpg'))
|
|
||||||
item.save()
|
item.save()
|
||||||
tasks.update_poster(item.public_id)
|
tasks.update_poster(item.public_id)
|
||||||
response = json_response()
|
response = json_response()
|
||||||
|
|
Loading…
Reference in a new issue