From da5343715a1aed2a312fcb71a9d1c5c4681b7d98 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 16 Mar 2012 17:16:02 +0100 Subject: [PATCH] better multiline srt export --- pandora/item/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index e85159776..71ae94c69 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1258,10 +1258,14 @@ class Item(models.Model): Clip.objects.filter(item=self, annotations__id=None).delete() def srt(self, layer): + def format_value(value): + value = value.replace('
', '
').replace('
\n', '\n').replace('
', '\n') + value = value.replace('\n\n', '
\n') + return value return ox.srt.encode([{ 'in': a.start, 'out': a.end, - 'value': a.value.replace('
', '
').replace('
\n', '\n').replace('
', '\n') + 'value': format_value(a.value) } for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')]) def delete_item(sender, **kwargs):