make subtitles in/out/value unique before importing
This commit is contained in:
parent
8a2408ff7e
commit
9273d7b3ba
1 changed files with 7 additions and 1 deletions
|
@ -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']:
|
||||
|
|
Loading…
Reference in a new issue