diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index bdca993d..0322057d 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -161,5 +161,5 @@ class Annotation(models.Model): return j def __unicode__(self): - return u"%s/%s-%s" %(self.item, self.start, self.end) + return u"%s %s-%s" %(self.public_id, self.start, self.end) diff --git a/pandora/archive/extract.py b/pandora/archive/extract.py index 8133946e..1c952ffe 100644 --- a/pandora/archive/extract.py +++ b/pandora/archive/extract.py @@ -294,11 +294,12 @@ def average_color(prefix, start=0, end=0): timelines = sorted(filter(lambda t: t!= '%s%sp.png'%(prefix,height), glob("%s%sp*.png"%(prefix, height)))) for image in timelines: start_offset = 0 - timeline = Image.open(image).convert('RGB') - frames += timeline.size[0] - if start and frames < start: + if start and frames + 1500 < start: + frames += 1500 continue - elif start and frames > start > frames-timeline.size[0]: + timeline = Image.open(image) + frames += timeline.size[0] + if start and frames > start > frames-timeline.size[0]: start_offset = start - (frames-timeline.size[0]) box = (start_offset, 0, timeline.size[0], height) timeline = timeline.crop(box) @@ -307,7 +308,7 @@ def average_color(prefix, start=0, end=0): box = (0, 0, end_offset, height) timeline = timeline.crop(box) - p = np.asarray(timeline, dtype=np.float32) + p = np.asarray(timeline.convert('RGB'), dtype=np.float32) p = np.sum(p, axis=0) / height #average color per frame pixels.append(p) diff --git a/pandora/item/models.py b/pandora/item/models.py index 1b79a700..c7d8bf27 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -935,7 +935,7 @@ class Item(models.Model): def make_timeline(self): streams = self.streams() - if len(streams) > 1: + if streams.count() > 1: timelines = [s.timeline_prefix for s in self.streams()] join_timelines(timelines, self.timeline_prefix)