From 9273d7b3ba035eef463de8b7f3990e595fb6e653 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 4 Feb 2015 15:56:37 +0530 Subject: [PATCH] make subtitles in/out/value unique before importing --- pandora/archive/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index d8ac6c454..858eab17d 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -279,7 +279,13 @@ class File(models.Model): return None def srt(self, offset=0): - srt = ox.srt.load(self.data.path) + srt = [] + subtitles = [] + for s in ox.srt.load(self.data.path): + key = '%s --> %s\n%s' % (s['in'], s['out'], s['value']) + if key not in subtitles: + subtitles.append(key) + srt.append(s) #subtitles should not overlap for i in range(1, len(srt)): if srt[i-1]['out'] > srt[i]['in']: