cleanup poster cache

This commit is contained in:
j 2016-07-30 09:39:31 +02:00
parent 893f2e5423
commit 5c90ff79a0

View file

@ -1403,14 +1403,14 @@ class Item(models.Model):
data = f.read()
if data:
self.save_poster(data)
poster = self.path('poster.jpg')
poster = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster))
for f in glob(poster.replace('.jpg', '*.jpg')):
if f != poster:
try:
os.unlink(f)
except OSError:
pass
poster = self.path('poster.jpg')
poster = os.path.abspath(os.path.join(settings.MEDIA_ROOT, poster))
for f in glob(poster.replace('.jpg', '*.jpg')):
if f != poster:
try:
os.unlink(f)
except OSError:
pass
def make_siteposter(self):
poster = self.path('siteposter.jpg')