forked from 0x2620/pandora
use stream height by default
This commit is contained in:
parent
31713e5f3b
commit
81748afa2d
2 changed files with 6 additions and 3 deletions
|
@ -241,7 +241,7 @@ def frame(videoFile, frame, position, height=128, redo=False):
|
|||
videoFile input
|
||||
frame output
|
||||
position as float in seconds
|
||||
width of frame
|
||||
height of frame
|
||||
redo boolean to extract file even if it exists
|
||||
'''
|
||||
if exists(videoFile):
|
||||
|
|
|
@ -850,7 +850,7 @@ class Item(models.Model):
|
|||
'''
|
||||
Video related functions
|
||||
'''
|
||||
def frame(self, position, height=128):
|
||||
def frame(self, position, height=None):
|
||||
offset = 0
|
||||
streams = self.streams()
|
||||
for stream in streams:
|
||||
|
@ -858,6 +858,9 @@ class Item(models.Model):
|
|||
offset += stream.duration
|
||||
else:
|
||||
position = position - offset
|
||||
if not height:
|
||||
height = stream.resolution
|
||||
else:
|
||||
height = min(height, stream.resolution)
|
||||
path = os.path.join(settings.MEDIA_ROOT, stream.path(),
|
||||
'frames', "%dp"%height, "%s.jpg"%position)
|
||||
|
|
Loading…
Reference in a new issue