better multiline srt export

This commit is contained in:
j 2012-03-16 17:16:02 +01:00
parent cd46c456af
commit da5343715a

View file

@ -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):