better multiline srt export
This commit is contained in:
parent
cd46c456af
commit
da5343715a
1 changed files with 5 additions and 1 deletions
|
@ -1258,10 +1258,14 @@ class Item(models.Model):
|
||||||
Clip.objects.filter(item=self, annotations__id=None).delete()
|
Clip.objects.filter(item=self, annotations__id=None).delete()
|
||||||
|
|
||||||
def srt(self, layer):
|
def srt(self, layer):
|
||||||
|
def format_value(value):
|
||||||
|
value = value.replace('<br/>', '<br>').replace('<br>\n', '\n').replace('<br>', '\n')
|
||||||
|
value = value.replace('\n\n', '<br>\n')
|
||||||
|
return value
|
||||||
return ox.srt.encode([{
|
return ox.srt.encode([{
|
||||||
'in': a.start,
|
'in': a.start,
|
||||||
'out': a.end,
|
'out': a.end,
|
||||||
'value': a.value.replace('<br/>', '<br>').replace('<br>\n', '\n').replace('<br>', '\n')
|
'value': format_value(a.value)
|
||||||
} for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')])
|
} for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')])
|
||||||
|
|
||||||
def delete_item(sender, **kwargs):
|
def delete_item(sender, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue