Up: GROVE
Last edit: <2020-12-13>

search term playlists


This is a brief overview of how I manage a local music collection in $current_year. I use Music Player Daemon (MPD) and youtube-dl to index and add music to big “local music” folder. Over the years structure is totally scattered, but at least for the import folder (youtube-dl) things always look like this: ${musicdir}/import/<channel>/<title>. MPD has many clients, but now I use a script that operates atop the mpc client.

For quite sometime, my music playing looked like this:

mpc clear
mpc listall | sort -R | head -n 1000 | mpc add

As you might imagine, this can lead to some jarring transitions and inconsistency with the 𝓜𝓞𝓞𝓓.

MPD has a notion of saving and loading playlists, but you have to add files individually to them/it’s a very tedious experience if you want to incorporate many kinds of vibes.

Enter my version of playlist files.

Playlist files are files where every line is a comment, except for lines starting with + or -. At the moment, here is my jazz_piano playlist:

# artists
+ryo fukui
+hiromi
+gabor szabo
+kitajima
+hitotaka izumi
+Minoru Muraoka
+alice coltrane

# albums
+flight to brazil

# generic
+piano
+jazz
+koto

# channel
+mogurin3131
+mogurin313131
+marcel the drunkard

# edd ed eddy is actually pretty jazzy
+ed, edd

# random
+touhou

-05 My Sick Piano.m4a
-Mario Basanov & Vidis  - I'll Be Gone (ft. Jazzu) _ Chill_Deep-6zaOfkd84Z0.m4a
-Dubmood - Bored at the piano-vQUlWsU_yZ4.m4a

Lines that start with a + are search terms against the current music collection (with a lenient grep against mpc listall) and lines that start with - are to remove search matches from the current mpc playlist. Removal is necessary because some search terms are so generic (here, piano). I then give music a function to process all the search matches. The advantage to this approach is whenever I add new stuff from an above artist or YouTube channel, it will automatically get added to the playlist!

The script may be found here. Here are it’s current options:

$ music
music options:
add        : add a url to library, fallback on clipboard content
append     : append some search term to the current playlist
artist     : play songs by an artist
bl         : blacklist the currently playing song from the current playlist.
del        : delete the currently playing song
info       : display the current song progress bar and playlist length
now        : fuzzy search for a song, play it now
nowmpv     : fuzzy search for a song, play it now with MPV
playlist   : select a search term based playlist to play
recent     : play recently added songs
remove     : remove some search match from the playlist
rename     : rename the currently playing song file name (keep directory)
shuffle    : reshuffle current selection from all

And an example of a fetch-like status (bar created with mkb):

$ music info
Hiromi Uehara 2006 Love and Laughter
◈◈◈◈◈◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇
playlist: jazz_piano | 60h 35m 13s