From e1bdc83980031c1521a4f7209af162688ae054dc Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 16 Aug 2011 17:06:40 +0200 Subject: [PATCH] select frame --- pandora/item/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora/item/models.py b/pandora/item/models.py index 76902731..4853cf7b 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -25,6 +25,7 @@ import ox from ox.django import fields from ox.normalize import canonicalTitle import ox.web.imdb +import ox.image import managers import utils @@ -952,6 +953,13 @@ class Item(models.Model): offset += f.duration return frames + def select_frame(self): + frames = self.poster_frames() + if frames: + heat = [ox.image.getImageHeat(f['path']) for f in frames] + self.poster_frame = heat.index(max(heat)) + self.save() + def get_poster_frame_path(self): frames = self.poster_frames() if self.poster_frame >= 0: