fix edit preview

This commit is contained in:
j 2023-07-15 12:28:15 +05:30
parent cff1c06546
commit a8cc838d7b
2 changed files with 5 additions and 6 deletions

View file

@ -190,11 +190,6 @@ class MetaClip(object):
def __str__(self):
return self.public_id
def get_first_frame(self, resolution=None):
if resolution is None:
resolution = max(settings.CONFIG['video']['resolutions'])
return '/%s/%sp%0.03f.jpg' % (self.item.public_id, resolution, float(self.start))
class Meta:
unique_together = ("item", "start", "end")

View file

@ -47,7 +47,11 @@ def index(request, fragment):
context['title'] = name
context['description'] = edit.description.split('\n\n')[0]
# FIXME: use sort from parts if needed
context['preview'] = request.build_absolute_uri(edit.get_clips().first().get_first_frame())
resolution = max(settings.CONFIG['video']['resolutions'])
clip = edit.get_clips().first()
if clip:
preview = '/%s/%sp%0.03f.jpg' % (clip.item.public_id, resolution, float(clip.start))
context['preview'] = request.build_absolute_uri(preview)
else:
type = 'item'
id = parts[0]