weizhenye / ass-compiler

Parses and compiles ASS subtitle format to easy-to-use data structure
https://ass.js.org/ass-compiler/
MIT License
107 stars 18 forks source link

Parsing non-standard event effects #12

Closed red5h4d0w closed 1 year ago

red5h4d0w commented 1 year ago

I would like if the parser could somehow parse the Effect Portion of an event as a string and expose it in the parsed object. For instance, it would be useful in determining what lines represent karaoke lines in the following example.

...
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Comment: 0,0:00:00.00,0:00:00.00,Sample KM [Up],,0,0,0,template pre-line all keeptags,!retime("line",$start < 900 and -$start or -900,200)!{!$start < 900 and "\\k" .. ($start/10) or "\\k90"!\fad(!$start < 900 and $start or 300!,200)}
Comment: 0,0:00:00.68,0:00:06.31,Sample KM [Up],,0,0,0,karaoke,{\k26}o{\k33}wa{\k71}ri {\k37}wo {\k39}ma{\k75}tsu {\k34}se{\k38}tsu{\k36}na {\k36}ni {\k40}ki{\k39}mi {\k59}wa
...

I understand that Effect can only EffectBanner or EffectScroll and that this utilisation is not part of v4.00+ ASS specifications, but the KaraTemplater from Aegisub ignores that all the time and uses the Effect property to store fx, template, karaoke and such instructions. This is why I think it could be useful

red5h4d0w commented 1 year ago

link to what the Karaoke Templater adds to the spec: https://aegisite.vercel.app/docs/latest/automation/karaoke_templater/declaring_template_and_code_lines/