From 64376795ff1f6dfc955a82573cb9070d3c555213 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 15 Sep 2012 12:23:17 +0200 Subject: [PATCH] fix offset option in srt --- pandora/archive/models.py | 7 +++++++ pandora/archive/tasks.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 9cd31a0c..188aa43d 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -214,6 +214,13 @@ class File(models.Model): for i in range(1, len(srt)): if srt[i-1]['out'] > srt[i]['in']: srt[i-1]['out'] = srt[i]['in'] + + def shift(s): + s['in'] += offset + s['out'] += offset + return s + if offset: + srt = map(shift, srt) return srt def editable(self, user): diff --git a/pandora/archive/tasks.py b/pandora/archive/tasks.py index fa63e89c..71cad8ec 100644 --- a/pandora/archive/tasks.py +++ b/pandora/archive/tasks.py @@ -19,7 +19,7 @@ def get_or_create_item(volume, info, user): item_info = ox.parse_movie_path(info['path']) if item_info.get('director') and item_info.get('directorSort'): for name, sortname in zip(item_info['director'], item_info['directorSort']): - get_name_sort(name, sortname) + get_name_sort(name, sortname) return get_item(item_info, user) def get_or_create_file(volume, f, user, item=None):