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
|
videoFile input
|
||||||
frame output
|
frame output
|
||||||
position as float in seconds
|
position as float in seconds
|
||||||
width of frame
|
height of frame
|
||||||
redo boolean to extract file even if it exists
|
redo boolean to extract file even if it exists
|
||||||
'''
|
'''
|
||||||
if exists(videoFile):
|
if exists(videoFile):
|
||||||
|
|
|
@ -850,7 +850,7 @@ class Item(models.Model):
|
||||||
'''
|
'''
|
||||||
Video related functions
|
Video related functions
|
||||||
'''
|
'''
|
||||||
def frame(self, position, height=128):
|
def frame(self, position, height=None):
|
||||||
offset = 0
|
offset = 0
|
||||||
streams = self.streams()
|
streams = self.streams()
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
|
@ -858,7 +858,10 @@ class Item(models.Model):
|
||||||
offset += stream.duration
|
offset += stream.duration
|
||||||
else:
|
else:
|
||||||
position = position - offset
|
position = position - offset
|
||||||
height = min(height, stream.resolution)
|
if not height:
|
||||||
|
height = stream.resolution
|
||||||
|
else:
|
||||||
|
height = min(height, stream.resolution)
|
||||||
path = os.path.join(settings.MEDIA_ROOT, stream.path(),
|
path = os.path.join(settings.MEDIA_ROOT, stream.path(),
|
||||||
'frames', "%dp"%height, "%s.jpg"%position)
|
'frames', "%dp"%height, "%s.jpg"%position)
|
||||||
if not os.path.exists(path) and stream.video:
|
if not os.path.exists(path) and stream.video:
|
||||||
|
|
Loading…
Reference in a new issue