chapters_for_mpv
chapters_for_mpv copied to clipboard
plugin fails if media filename contains newline
Hey.
At least for the case that the media file name contains a newline (\n
), but possibly also for other such unusual characters (perhaps \r
), the plugin fails, e.g.:
$ mpv --msg-level=chapters=debug 'a'$'\n''b.mp4'
[chapters] Loading lua script /home/user/.config/mpv/scripts/chapters.lua...
[chapters] loading mp.defaults
[chapters] loading file /home/user/.config/mpv/scripts/chapters.lua
[chapters] reading options for chapters
[chapters] Opened config file script-opts/chapters.conf.
[chapters] options: {"placeholder_title" = "Chapter ", "hash" = false, "ask_for_title" = true, "autosave" = false, "global_chapters" = true, "pause_on_input" = false, , "autoload" = true, "chapters_dir" = "/home/user/.config/mpv/chapters"}
[chapters] looking for: ./a
[chapters] b.mp4.ffmetadata
[chapters] looking in the global directory
[chapters] full_path, mpv: a
[chapters] b.mp4
[chapters] looking for command: realpath
[chapters] command found: /usr/bin/realpath
[chapters] command: {"/usr/bin/realpath", "--"}
[chapters] command2: {"/usr/bin/realpath", "--", "a
[chapters] b.mp4"}
[chapters] unix, full path: /home/user/ggg/ab.mp4
…
Cheers, Chris.