From 81748afa2d0141332939e184cb3c9210a48d5e4f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 17 Feb 2012 13:02:04 +0530 Subject: [PATCH] use stream height by default --- pandora/archive/extract.py | 2 +- pandora/item/models.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora/archive/extract.py b/pandora/archive/extract.py index a5a64525..19c76372 100644 --- a/pandora/archive/extract.py +++ b/pandora/archive/extract.py @@ -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): diff --git a/pandora/item/models.py b/pandora/item/models.py index 939e3aa8..74ee69d8 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -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,7 +858,10 @@ class Item(models.Model): offset += stream.duration else: 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(), 'frames', "%dp"%height, "%s.jpg"%position) if not os.path.exists(path) and stream.video: