A bookmarker menu to manage all your bookmarks in MPV. This script is based on mpv-bookmarker and has been rewritten to include a bookmarker menu. All of the code has been written from scratch, aside from the general file/JSON management utilities.
Notice: Bookmarks created with mpv-bookmarker can be loaded by this script and will be automatically converted. However, the bookmarks created with this script are not compatible with those created with mpv-bookmarker.
DEL
button now deletes the character after the cursor instead of clearing the whole string- Styling added for certain lines
- Currently selected line is now bold and yellow
- Typer cursor changed from
;
to a bold and yellow|
Allow custom tags for bookmark styling <\del>Undo function <\del>Redo function <\del>
Copy bookmarker-menu.lua
to the scripts folder for mpv then add the following lines to input.conf
:
B script_message bookmarker-menu
b script_message bookmarker-quick-save
ctrl+b script_message bookmarker-quick-load
The keys are only a suggestion, and can be changed to something else.
Open bookmarker-menu.lua
in a text editor, and you can easily change these settings:
-- Maximum number of characters for bookmark name
local maxChar = 100
-- Number of bookmarks to be displayed per page
local bookmarksPerPage = 10
-- Whether to close the Bookmarker menu after loading a bookmark
local closeAfterLoad = true
-- Whether to close the Bookmarker menu after replacing a bookmark
local closeAfterReplace = true
-- Whether to ask for confirmation to replace a bookmark (Uses the Typer for confirmation)
local confirmReplace = false
-- Whether to ask for confirmation to delete a bookmark (Uses the Typer for confirmation)
local confirmDelete = false
-- The rate (in seconds) at which the bookmarker needs to refresh its interface; lower is more frequent
local rate = 1.5
-- The filename for the bookmarks file
local bookmarkerName = "bookmarker.json"
It's recommended not to touch bookmarkerName
but it's there to be changed in case you already have a file called bookmarker.json
and don't want that to be overwritten, or to change it to bookmarks.json
to convert bookmarks created by mpv-bookmarker.
B
or whichever key you configured ininput.conf
: Pull up the Bookmarker menub
or whichever key you configured ininput.conf
: Quickly add a new bookmarkctrl+b
or whichever key you configured ininput.conf
: Quickly load the latest bookmark
B
or whichever key you configured ininput.conf
: Close the Bookmarker menuESC
: Close the Bookmarker menuUP/DOWN
: Navigate through the bookmarks on the current page (Hold to quickly scroll)LEFT/RIGHT
: Navigate through pages of bookmarks (Hold to quickly scroll)ENTER
: Load the currently selected bookmarkDELETE
: Delete the currently selected bookmarks
: Save a bookmark of the current media file and positionshift+s
: Save a bookmark of the current media file and position (shows a text input, allowing you to type)p
: Replace the currently selected bookmark with the current media file and positionr
: Rename the currently selected bookmark (shows a text input, allowing you to type)f
: Change the filepath of the currently selected bookmark (shows a text input, allowing you to type)m
: Move the currently selected bookmark
Replacing a bookmark is intended for when you have a bookmark for your current progress in a TV series. When you've finished a new episode, you can select this bookmark and press p
to instantly rewrite that bookmark with your current progress, leaving the name and its position in the list of bookmarks intact.
Changing the filepath of a bookmark is intended to quickly change a bookmark in case you moved the media file to a different folder, or perhaps the drive letter of your external drive changed.
The Typer (as I named it) allows you to type text for various ends, like renaming a bookmark or changing its filepath.
ESC
: Cancel text input and return to the Bookmarker menuENTER
: Confirm text input and save/rename the bookmarkLEFT/RIGHT
: Move the cursor through the text, allowing you to input text in different places (Hold to quickly scroll)BACKSPACE
: Remove the character preceding the cursor (Hold to rapidly remove multiple)DELETE
: Remove the character after the cursor (Hold to rapidly remove multiple)Any text character
: Type for the text input. Allows special characters, spaces, numbers. Does not allow letters with accents (Hold to rapidly add characters)
During text input for a bookmark's name, you can write %t
or %p
to input a timestamp in the name. (Note: This does not work for a bookmark's filepath.)
%t
is a timestamp in the format of hh:mm:ss.mmm%p
is a timestamp in the format of S.mmm
For example, Awesome moment @ %t
will show up as Awesome moment @ 00:13:41.673
in the menu
ESC
: Cancel moving and return to the Bookmarker menuENTER
: Confirm moving the bookmarkm
: Confirm moving the bookmarks
: Save a bookmark of the current file and positionUP/DOWN
: Navigate through the bookmarks on the current page (Hold to quickly scroll)LEFT/RIGHT
: Navigate through pages of bookmarks (Hold to quickly scroll)
This has been tested on Windows. In theory, it should also work for Unix systems, but it hasn't been tested on those.
DEL
button now deletes the character after the cursor instead of clearing the whole string- Styling added for certain lines
- Currently selected line is now bold and yellow
- Typer cursor changed from
;
to a bold and yellow|
- Added the ability to replace bookmarks with the currently playing file and position (See Usage for more info)
- Bookmarks from mpv-bookmarker can now be loaded and will be automatically converted
- Certain keys are now repeated while holding the button, eliminating the need to constantly tap the same button
- Added the option to automatically close the menu after replacing a bookmark
- Added the option whether to ask for confirmation before replacing/deleting a bookmark
- Added more error messages
- Slightly changed up how forced controls are programmed and activated to accomodate the repeated keys
- Slightly changed up how bookmarks are created in the code to accomodate replacing them
- Added a cursor to the Typer, allowing you to insert text in other places than the end of the line
- Added the ability to change the filepath of a bookmark, in case you moved files to a different folder, or your external drive is suddenly assigned a different drive letter
- Changed the way filepaths are saved and loaded, to accomodate the ability to edit them
- Introduced version numbers to the bookmarks for potential backward compatibility
- Because of this, all older bookmarks should still be compatible with version 1.2.0
- The default bookmark name now uses
media-title
instead offilename
- Changed some of the messages and added a few more error messages
- Added minor property expansion to the Typer
- You can type
%t
or%p
for the bookmark name and have it expand into the time or position respectively - Added checks for all faulty behavior that I could think of and added error messages for those situations
- Cleaned up the code a bit
- Added keypad keys to the Typer
- It's possible to commit moving files with the keypad enter key as well
- Added the option to close the bookmarker menu after loading a bookmark
- Initial release