dbpdlnmpv is an evolution of pdlnmpv that uses a sqlite database to manage local playlists in conjunction with dmenu. Dmenu is a straightforward tool for creating simple menus. Simply pipe something into it, and it will display as a menu on the screen. It is used in this case to show the user read and select operations.
All of these script files interact as follows:
- dbplnmpv.py is in charge of all database operations such as create, read, update, and delete.
- dbmpv.py is in charge of interacting with dbplnmpv.py via a simple, straightforward command-line interface.
- dbanimeplaylist.sh is a bash script that runs dbmpv and outputs the results to dmenu. This is the main interface, which can be accessed via keybindings or a.desktop file on GNU/Linux. Before you can use it, you must change the three variables at the top:
DB_FILE
,TABLE_NAME
, andWATCH_FOLDER
to something you prefer. IfDB_FILE
orTABLE_NAME
does not exist,dbplnmpv.py
will create it for you.
You can run dbanimeplaylist.sh if you have dmenu installed on your system, either from source or via your distro's package manager. Ddmenu will appear on the screen with four menu entries (Watch, Update, Watched, Add), and you can select any of them with the arrow keys on the keyboard and enter:
-
Watch
A secondary dmenu will show up listing the database entries (in this case anime episodes) that are marked as not watched, if you press enter in one of the rows the episode will be played in fullscreen using mpv. Behind the scenes this option also updates database rows to
deleted = 1
if their files have already been deleted. -
Update
A secondary dmenu will show up listing all rows that their file are still on disk, if you select one its watched status will flip
-
Watched
Similar to Watch, but will list already watched entries and selecting it will also play their file with mpv.
-
Add
It will add a row to the database with the contents of your clipboard as the title
dbanimeplaylist.sh is just a helper script that integrates dbmpv.py with dmenu and mpv; you can actually use dbmpv directly. When using it this way, you must always pass the positional arguments DB_FILE
and TABLE_NAME
.
For a comprehensive list of options, type and execute dbmpv --help
on your terminal.
-
--create
:This option will write a row
dbmpv "$HOME/.local/share/playlists.db" animeplaylist --create "[ASW] Ars no Kyojuu - 10 [1080p HEVC][6C8C78F0].mkv"
-
--read
:This will query for unwatched entries and print the results to standard output.
dbmpv "$HOME/.local/share/playlists.db" animeplaylist --read
- if you add the
-w/--watched
option you'll get watched entries instead. - By default, the ordering is ascending; however, if you pass the
-d/--desc
option, the ordering will be inverted to descending.
- if you add the
-
--readall
:This option will output all rows, regardless of whether they are watched or not, but will ignore rows with
deleted = 1
.dbmpv "$HOME/.local/share/playlists.db" animeplaylist --read
-
--update
:Because the update option will update a row's watched status, you also needs to pass the
--id <id>
option.dbmpv "$HOME/.local/share/playlists.db" animeplaylist --update --id 234