update_poster should always update poster
This commit is contained in:
parent
2aef460225
commit
c4a95bc320
2 changed files with 7 additions and 3 deletions
|
@ -1392,6 +1392,11 @@ class Item(models.Model):
|
||||||
for f in glob(os.path.join(settings.MEDIA_ROOT, self.path(), 'timeline*.jpg')):
|
for f in glob(os.path.join(settings.MEDIA_ROOT, self.path(), 'timeline*.jpg')):
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
|
|
||||||
|
def remove_poster(self):
|
||||||
|
if self.poster:
|
||||||
|
self.clear_poster_cache(self.poster.path)
|
||||||
|
self.poster.delete()
|
||||||
|
|
||||||
def clear_poster_cache(self, poster):
|
def clear_poster_cache(self, poster):
|
||||||
for f in glob(poster.replace('.jpg', '*.jpg')):
|
for f in glob(poster.replace('.jpg', '*.jpg')):
|
||||||
if f != poster:
|
if f != poster:
|
||||||
|
@ -1442,9 +1447,7 @@ class Item(models.Model):
|
||||||
ox.makedirs(os.path.join(settings.MEDIA_ROOT, self.path()))
|
ox.makedirs(os.path.join(settings.MEDIA_ROOT, self.path()))
|
||||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, close_fds=True)
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, close_fds=True)
|
||||||
p.communicate(json.dumps(data, default=fields.to_json))
|
p.communicate(json.dumps(data, default=fields.to_json))
|
||||||
for f in glob(poster.replace('.jpg', '*.jpg')):
|
self.clear_poster_cache(poster)
|
||||||
if f != poster:
|
|
||||||
os.unlink(f)
|
|
||||||
return poster
|
return poster
|
||||||
|
|
||||||
def poster_frames(self):
|
def poster_frames(self):
|
||||||
|
|
|
@ -54,6 +54,7 @@ def update_clips(public_id):
|
||||||
@task(ignore_results=True, queue='default')
|
@task(ignore_results=True, queue='default')
|
||||||
def update_poster(public_id):
|
def update_poster(public_id):
|
||||||
item = models.Item.objects.get(public_id=public_id)
|
item = models.Item.objects.get(public_id=public_id)
|
||||||
|
item.remove_poster()
|
||||||
item.make_poster()
|
item.make_poster()
|
||||||
item.make_icon()
|
item.make_icon()
|
||||||
if item.poster and os.path.exists(item.poster.path):
|
if item.poster and os.path.exists(item.poster.path):
|
||||||
|
|
Loading…
Reference in a new issue