From ed5bc510a98ea33ff6c7ae1de48d83351acd8236 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 5 Feb 2015 18:29:18 +0530 Subject: [PATCH] ignore subtitles with in > out --- pandora/archive/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 858eab17d..8de996312 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -282,10 +282,11 @@ class File(models.Model): 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) + if s['in'] <= s['out']: + 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']: