We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 719a501 commit 45d297fCopy full SHA for 45d297f
ssa.go
@@ -63,6 +63,9 @@ func NewFromSSA(s string) (res Subtitle, err error) {
63
continue
64
}
65
66
+ // some ass/ssa files use \N as a line break in captions
67
+ text = strings.ReplaceAll(text, "\\N", "\\n")
68
+
69
o.Text = strings.Split(text, "\\n")
70
71
if len(o.Text) > 0 {
ssa_test.go
@@ -10,7 +10,8 @@ func TestNewFromSsa(t *testing.T) {
10
in := "[Events]\n" +
11
"Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text\n" +
12
"Dialogue: 0,0:01:06.37,0:01:08.04,Default,,0000,0000,0000,,Honey, I'm home!\n" +
13
- "Dialogue: 0,0:01:09.05,0:01:10.69,Default,,0000,0000,0000,,Hi.\\n- Hi, love.\n"
+ "Dialogue: 0,0:01:09.05,0:01:10.69,Default,,0000,0000,0000,,Hi.\\n- Hi, love.\n" +
14
+ "Dialogue: 0,0:02:41.77,0:02:43.74,dazed,,0000,0000,0000,,- I'm headed this way.\\N- Oh.\n"
15
expected := Subtitle{[]Caption{{
16
1,
17
makeTime(0, 1, 6, 370),
@@ -21,6 +22,11 @@ func TestNewFromSsa(t *testing.T) {
21
22
makeTime(0, 1, 9, 50),
23
makeTime(0, 1, 10, 690),
24
[]string{"Hi.", "- Hi, love."},
25
+ }, {
26
+ 3,
27
+ makeTime(0, 2, 41, 770),
28
+ makeTime(0, 2, 43, 740),
29
+ []string{"- I'm headed this way.", "- Oh."},
30
}}}
31
res, err := NewFromSSA(in)
32
assert.Equal(t, nil, err)
0 commit comments