Usage with betterchapters.lua
Hello First I want to say that this is (in my opinion) by far the best OSC for MPV out there. You've done a great job with the customization options and especially the documentation.
Quick question, is there any way I could replace the default chapter button behavior to work like betterchapters.lua, meaning that before the first chapter it would navigate to to the previous playlist item and after the last chapter to the next playlist item

PS: there's a small typo in the README, you have it's documentation instead of its documentation
Thanks for pointing out the typo.
You can Ctrl+F for ch_next
--ch_next
ne = new_element("ch_next", "button")
ne.visible = have_ch
ne.enabled = have_ch
ne.content = tethysIcon_ch_next
ne.eventresponder["mbtn_left_up"] =
function ()
mp.commandv("add", "chapter", 1)
if user_opts.chapters_osd then
show_message(get_chapterlist(), 3)
end
end
ne.eventresponder["shift+mbtn_left_up"] =
function () show_message(get_chapterlist(), 3) end
ne.eventresponder["mbtn_right_up"] =
function () show_message(get_chapterlist(), 3) end
If this is what you want:
https://github.com/Argon-/mpv-config/blob/master/scripts/betterchapters.lua
I've tried looking for a way to detect if betterchapters.lua is loaded but can't find anything. Maybe if "chapterplaylist-next" keybinding is registered I could call that keybinding?
Might be easier to just include the function and add a toggle in the config (default=off though).
That's exactly what I needed, thanks!
Might be easier to just include the function and add a toggle in the config (default=off though).
This seems like the best course of action After pasting in the chapter_seek function, I changed these lines
ne.eventresponder["mbtn_left_up"] =
function ()
mp.commandv("add", "chapter", 1)
if user_opts.chapters_osd then
show_message(get_chapterlist(), 3)
end
end
to this:
ne.eventresponder["mbtn_left_up"] =
function () chapter_seek(1) end
And made sure it detected the proper keybinds
local chPrevBinds = grepBindByCmd("^script%-binding(%s+)betterchapters/chapter_prev", {})
local chNextBinds = grepBindByCmd("^script%-binding(%s+)betterchapters/chapter_next", {})
I'd love to see it included by default one day