Last active
March 8, 2025 03:50
-
-
Save Hakkin/4f978a5c87c31f7fe3ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- betterchapters.lua | |
-- Loads the next or previous playlist entry if there are no more chapters in the seek direction. | |
-- To bind in input.conf, use: <keybind> script_binding <keybind name> | |
-- Keybind names: chapter_next, chapter_prev | |
-- Recommended to use with autoload.lua | |
function chapter_seek(direction) | |
local chapters = mp.get_property_number("chapters") | |
local chapter = mp.get_property_number("chapter") | |
if chapter == nil then chapter = 0 end | |
if chapters == nil then chapters = 0 end | |
if chapter+direction < 0 then | |
mp.command("playlist_prev") | |
elseif chapter+direction >= chapters then | |
mp.command("playlist_next") | |
else | |
mp.commandv("osd-msg", "add", "chapter", direction) | |
end | |
end | |
mp.add_key_binding("PGUP", "chapter_next", function() chapter_seek(1) end) | |
mp.add_key_binding("PGDWN", "chapter_prev", function() chapter_seek(-1) end) |
Any way to make it work for files with no chapters?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any way to also go to the previous file if "skip to previous chapter" is used very close to the first chapter? Tto make it act like MPC-HC.
And also to hide the "Chapter (unavailable)" message?