From d7a96c72a16563be39d97f0a8bc9114439e8ef8d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 6 Mar 2013 16:57:46 +0100 Subject: [PATCH] fix get_sequences --- pandora/sequence/models.py | 2 +- pandora/sequence/tasks.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pandora/sequence/models.py b/pandora/sequence/models.py index c729f161..314997f1 100644 --- a/pandora/sequence/models.py +++ b/pandora/sequence/models.py @@ -26,7 +26,7 @@ class Sequence(models.Model): sort = models.ForeignKey(ItemSort, null=True, related_name='sequences') hash = models.BigIntegerField(db_index=True, default=-9223372036854775808) - start = models.FloatField(default=-1, db_index=True) + start = models.FloatField(default=-1) end = models.FloatField(default=-1) duration = models.FloatField(default=0) diff --git a/pandora/sequence/tasks.py b/pandora/sequence/tasks.py index c2c2fa12..5916c483 100644 --- a/pandora/sequence/tasks.py +++ b/pandora/sequence/tasks.py @@ -4,12 +4,13 @@ from django.db import connection, transaction from celery.task import task import models +import item.models import extract @task(ignore_results=True, queue='encoding') def get_sequences(itemId): - i = models.Item.objects.get(itemId=itemId) - models.Sequence.objects.filter(item=i).delete() + i = item.models.Item.objects.get(itemId=itemId) + models.Sequence.objects.filter(sort=i.sort).delete() position = 0 for stream in i.streams(): data, position = extract.get_sequences(stream.timeline_prefix, position) @@ -19,7 +20,7 @@ def get_sequences(itemId): for s in data[mode]: sequence = { 'sort_id': i.sort.pk, - 'mode': mode, + 'mode': models.Sequence.MODE[mode], 'start': float('%0.03f' % s['in']), 'end': float('%0.03f' % s['out']), 'hash': models.parse_hash(s['hash'])