forked from 0x2620/pandora
fix edit preview
This commit is contained in:
parent
cff1c06546
commit
a8cc838d7b
2 changed files with 5 additions and 6 deletions
|
@ -190,11 +190,6 @@ class MetaClip(object):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.public_id
|
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:
|
class Meta:
|
||||||
unique_together = ("item", "start", "end")
|
unique_together = ("item", "start", "end")
|
||||||
|
|
|
@ -47,7 +47,11 @@ def index(request, fragment):
|
||||||
context['title'] = name
|
context['title'] = name
|
||||||
context['description'] = edit.description.split('\n\n')[0]
|
context['description'] = edit.description.split('\n\n')[0]
|
||||||
# FIXME: use sort from parts if needed
|
# 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:
|
else:
|
||||||
type = 'item'
|
type = 'item'
|
||||||
id = parts[0]
|
id = parts[0]
|
||||||
|
|
Loading…
Reference in a new issue