From 5ec09e804dbc5b9518c5d520d9e5e277f9fb5d8f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 6 Mar 2013 14:19:13 +0000 Subject: [PATCH] avoid overlapping annotations --- pandora/annotation/management/commands/import_srt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/annotation/management/commands/import_srt.py b/pandora/annotation/management/commands/import_srt.py index e203593ed..fa65cb45e 100644 --- a/pandora/annotation/management/commands/import_srt.py +++ b/pandora/annotation/management/commands/import_srt.py @@ -34,6 +34,9 @@ class Command(BaseCommand): annotations = ox.srt.load(filename) print 'importing %d annotations into %s/%s' % (len(annotations), itemId, layer_id) + for i in range(len(annotations)-1): + if annotations[i]['out'] == annotations[i+1]['in']: + annotations[i]['out'] = annotations[i]['out'] - 0.001 with transaction.commit_on_success(): for a in annotations: if a['value']: @@ -41,7 +44,8 @@ class Command(BaseCommand): item=item, layer=layer_id, user=user, - start=float(a['in']), end=float(a['out']), + start=float(a['in']), + end=float(a['out']), value=a['value']) annotation.save() #update facets if needed