~seirdy/mpd-scripts

Various scripts for mpd
3 months ago

2a2c173 Document switch from mpDris2 to mpd-mpris

3 months ago

#mpd-scripts

sourcehut GitLab mirror GitHub mirror Codeberg mirror

A collection of useful MPD scripts, written in bashism-free POSIX shell.

#media-control

media-control wraps Playerctl and mpc. If MPD is running, this "translates" Playerctl commands (play-pause, previous, next) to mpc commands; otherwise, it forwards commands to Playerctl. This is useful for binding XF86Audio* keys to prioritize MPD over other MPRIS players.

When forwarding commands to Playerctl, it adds $HOME/.local/lib to $LD_LIBRARY_PATH and $GI_TYPELIB_PATH if Playerctl has been installed with prefix $HOME/.local

#start-music and stop-music

start-music starts MPD and mpd-mpris. stop-music stops these, as well as kunst, cava, ncmpcpp, clerk, cantata-dynamic, and projectM.

MPD, mpd-mpris, and cantata-dynamic are managed by Systemd. Yes, I know, I know...

#Smart playlists

Scripts in the "smart-playlists" directory utilize MPD's pseudo-standard "rating" sticker, taking values from 1-10. Programs such as cantata, gmpc, ncmpy, and clerk use this sticker.

mpd-playlist-above-rating takes an integer argument from 0-10, and outputs a playlist containing tracks above the given rating.

mpd-playlist-unrated outputs a list of tracks without a "rating" sticker. This is useful for listening to music in your library you haven't heard yet.

mpd-playlist-smart generates a playlist skewed towards your favorite tracks, intended to be played with shuffle on. The playlist is built according to one rule: the number of times a track appears is equal to its rating minus 5 (or 0, whichever is greater). As a result, tracks must contain a rating of at least 6 to be added. Tracks rated 6/10 appear once, while tracks rated 10/10 appear four times. The higher you rate a track, the more likely it is to be played on shuffle. It requires mpd-playlist-above-rating.

Use rate-track, or the Cantata player to set ratings.

#Now Playing

Scripts in the now-playing directory operate on the current track. They display the currently-playing track with some extra info, get/set the track's rating and other stickers, etc.

#MPRIS

The mpris/ directory has scripts that work with MPRIS rather than directly through mpd. They combine well with a program such as mpd-mpris to bridge mpd and MPRIS.