chapterskip icon indicating copy to clipboard operation
chapterskip copied to clipboard

Solidus in chapter title cannot be escaped

Open 0n-s opened this issue 1 year ago • 2 comments

I am trying to add this category: categories=sb>^%[SponsorBlock%]: Sponsor/^%[SponsorBlock%]: Intermission%/Intro Animation

Just to be very explicit, this is supposed to match precisely [SponsorBlock]: Sponsor & [SponsorBlock]: Intermission/Intro Animation. However, playing a video with a chapter with the latter title, makes chapterskip spit out this error:

[chapterskip] 
[chapterskip] stack traceback:
[chapterskip] 	[C]: in function 'match'
[chapterskip] 	...-0-unstable-2022-09-08/share/mpv/scripts/chapterskip.lua:29: in function 'matches'
[chapterskip] 	...-0-unstable-2022-09-08/share/mpv/scripts/chapterskip.lua:63: in function 'prop'
[chapterskip] 	mp.defaults:412: in function 'handler'
[chapterskip] 	mp.defaults:515: in function 'call_event_handlers'
[chapterskip] 	mp.defaults:557: in function 'dispatch_events'
[chapterskip] 	mp.defaults:508: in function <mp.defaults:507>
[chapterskip] 	[C]: in ?
[chapterskip] 	[C]: in ?
[chapterskip] Lua error: ...-0-unstable-2022-09-08/share/mpv/scripts/chapterskip.lua:29: malformed pattern (ends with '%')

I believe this is because the solidus there cannot be escaped & is interpreted as a separator. How would I go about escaping it?

0n-s avatar Dec 05 '24 19:12 0n-s

Hi, indeed it can't be escaped currently. Just match any character with . e.g. ^%[SponsorBlock%]: Intermission.Intro Animation

po5 avatar Dec 06 '24 16:12 po5

Sure, that's what I'm doing right now. But I'd like to do it in a non-hacky fashion, so I suppose I'll keep this issue open until that's possible.

0n-s avatar Dec 06 '24 17:12 0n-s