Now handling ssa styles with leading * in events

This commit is contained in:
Quentin Renard
2022-12-14 11:45:30 +01:00
parent 356dc1d1ec
commit c19fe10597
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -1056,10 +1056,12 @@ func (e *ssaEvent) item(styles map[string]*Style) (i *Item, err error) {
// Set style
if len(e.style) > 0 {
var ok bool
if i.Style, ok = styles[e.style]; !ok {
err = fmt.Errorf("astisub: style %s not found", e.style)
return
// Sometimes there's an "*" before the style name (e.g. with ffmpeg)
for _, name := range []string{e.style, strings.TrimPrefix(e.style, "*")} {
if s, ok := styles[name]; ok {
i.Style = s
break
}
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ Style: 3,f3,6,&H00B4FCFC,&H00B4FCFC,&H00000008,&H00000008,0,0,9,3,6,9,3,6,9,0.3,
Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: Marked=0,0:01:39.00,0:01:41.04,1,Cher,1234,2345,3456,test,{\pos(400,570)}(deep rumbling)
Dialogue: Marked=1,0:02:04.08,0:02:07.12,2,autre,0000,0000,0000,,MAN:\nHow did we end up here?
Dialogue: Marked=1,0:02:12.16,0:02:15.20,3,autre,0000,0000,0000,,This place is horrible.
Dialogue: Marked=1,0:02:12.16,0:02:15.20,*3,autre,0000,0000,0000,,This place is horrible.
Not understood line
Dialogue: Marked=1,0:02:20.24,0:02:22.28,1,autre,0000,0000,0000,,Smells like balls.
Dialogue: Marked=1,0:02:28.32,0:02:31.36,2,autre,0000,0000,0000,,We don't belong\nin this shithole.