playlistdb: Keep track of on disk playlists.
Project description
When following multiple series, keeping track of which episodes were watched can become a tedious task. This project aims to offload this task to a database.
Installation
Via PyPI:
pip install playlistdb
From source:
git clone https://github.com/jfjlaros/playlist.git cd playlist pip install .
Usage
The program playlist is used to add and remove files and to set configuration options per directory, i.e., for every directory a new entry is added to the database.
The add command can be used to add files, any configuration specific for these files can be added with the config subcommand.
playlist add *.mkv playlist config '-sid 1'
This adds all files with extension .mkv to the database. The configuration -sid 1, a command line option for mplayer, is added for the current directory.
An overview of the database contents for the current directory can be seen with the show subcommand.
$ playlist show Playlist: * 00 - Credits.mkv 00 - Intro.mkv 01 - Episode 1.mkv 02 - Episode 2.mkv 03 - Episode 3.mkv Config: -sid 1
The * marks the current file, this file is next in line to be played.
Entries can be removed by using the remove subcommand:
playlist remove '00 - Credits.mkv'
The current file can be retrieved with the current subcommand and set to a specific file with the set subcommand. The configuration can be retrieved with show_config:
$ playlist current 00 - Intro.mkv $ playlist set '01 - Episode 1.mkv' $ playlist current 01 - Episode 1.mkv $ playlist show_config -sid 1
Finally, the next subcommand will show the current file and will set the current file to the next entry.
$ playlist next 01 - Episode 1.mkv $ playlist next 02 - Episode 2.mkv
The output of these commands can be passed to any program. It may be convenient to make an alias for particular application, for example:
alias playnext='mplayer $(playlist show_config) "$(playlist next)"'
Database
The database is stored in $HOME/.cache/playlist/db.yml. Since it is stored in YAML format, it can easily be modified using any text editor.
The database entry for our example looks as follows:
/media/Show:
config: -sid 1
files:
- 00 - Intro.mkv
- 01 - Episode 1.mkv
- 02 - Episode 2.mkv
- 03 - Episode 3.mkv
offset: 3
The top-level key /media/Show is also the name of the directory that contains the files to be played, the configuration for this directory is stored in the config variable, the file list is stored in files. The offset variable contains the index of the current file. If this index is larger or equal to the length of the list, then the playlist is finished.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file playlistdb-0.0.3.tar.gz
.
File metadata
- Download URL: playlistdb-0.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | caf371508c3f4d0737acc8843d39c4008492b39c6454bfa2cab97292fcd509fc |
|
MD5 | 969064c07022d0a7c3c74507840bcfde |
|
BLAKE2b-256 | d74fe50c9b9733d4e3c70a5632f65ba8dff5797b1eaf299f3f3a0da61605954c |