forked from 0x2620/pandora
ignore subtitles that are longer than the video.
This commit is contained in:
parent
abf445b7f1
commit
d39c237b04
1 changed files with 12 additions and 9 deletions
|
@ -1569,15 +1569,18 @@ class Item(models.Model):
|
||||||
for data in s.srt(offset):
|
for data in s.srt(offset):
|
||||||
subtitles_added = True
|
subtitles_added = True
|
||||||
value = data['value'].replace('\n', '<br>\n').replace('<br><br>\n', '<br>\n')
|
value = data['value'].replace('\n', '<br>\n').replace('<br><br>\n', '<br>\n')
|
||||||
annotation = Annotation(
|
if data['in'] < self.json['duration'] and data['out'] > self.json['duration']:
|
||||||
item=self,
|
data['out'] = self.json['duration']
|
||||||
layer=layer,
|
if data['in'] < self.json['duration']:
|
||||||
start=float('%0.03f'%data['in']),
|
annotation = Annotation(
|
||||||
end=float('%0.03f'%data['out']),
|
item=self,
|
||||||
value=value,
|
layer=layer,
|
||||||
user=user
|
start=float('%0.03f'%data['in']),
|
||||||
)
|
end=float('%0.03f'%data['out']),
|
||||||
annotation.save()
|
value=value,
|
||||||
|
user=user
|
||||||
|
)
|
||||||
|
annotation.save()
|
||||||
#otherwise add empty 5 seconds annotation every minute
|
#otherwise add empty 5 seconds annotation every minute
|
||||||
if not subtitles_added:
|
if not subtitles_added:
|
||||||
start = offset and int (offset / 60) * 60 + 60 or 0
|
start = offset and int (offset / 60) * 60 + 60 or 0
|
||||||
|
|
Loading…
Reference in a new issue