forked from 0x2620/pandora
clear siteposter cache too
This commit is contained in:
parent
5488eaf223
commit
c19598c4d7
2 changed files with 5 additions and 3 deletions
|
@ -1412,7 +1412,9 @@ class Item(models.Model):
|
||||||
self.clear_poster_cache(self.poster.path)
|
self.clear_poster_cache(self.poster.path)
|
||||||
self.poster.delete()
|
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')):
|
for f in glob(poster.replace('.jpg', '*.jpg')):
|
||||||
if f != poster:
|
if f != poster:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -673,8 +673,8 @@ def setPoster(request, data):
|
||||||
valid_sources = [p['source'] for p in item.get_posters()]
|
valid_sources = [p['source'] for p in item.get_posters()]
|
||||||
if data['source'] in valid_sources:
|
if data['source'] in valid_sources:
|
||||||
item.poster_source = data['source']
|
item.poster_source = data['source']
|
||||||
if item.poster:
|
item.remove_poster()
|
||||||
item.poster.delete()
|
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