♫> Listlace
Listlace is an mpd (music player daemon) client that uses a Ruby prompt as the interface, allowing you to use the power of Ruby to query your music library and build playlists.
Install
It's a gem, so do this:
$ gem install listlace
Listlace is an mpd client, so make sure mpd is installed and running in the background.
Usage
The gem gives you an executable, so do this:
$ listlace
It gives you a prompt, which is just a Ruby prompt, with the commands below implemented as methods.
Selectors
Query your music library and build playlists using selectors. There are selectors for each tag (artist, album, title, etc.) As an example, here is how artist works:
It returned an Array of 8 Songs.
You can pass multiple queries to a selector, and it will select all songs that match any of those queries:
You can chain selectors together to narrow down a playlist:
String selectors
The string selectors are: title, artist, album, and genre.
String selectors have "exact" counterparts: title_exact, artist_exact, album_exact, and genre_exact.
Use these "exact" selectors to do an exact, case-sensitive search:
The first one didn't match anything, the second one matched the same 8 songs.
You can also pass in a Regexp or a Symbol to a string selector:
Underscores in symbols are interpreted as spaces.
Numeric selectors
The numeric selectors are: track, disc, and year.
In addition to Integers, you can pass a Range to match against or a Hash that specifies one or more comparison operators:
The comparison operators are :eq, :ne, :gt, :ge, :lt, and :le. You can also just use :==, :>, :>=, :<, and :<=.
Time selectors
The time selector is just time, which matches the length of songs in seconds.
It's basically a numeric selector, but you can pass a String containing a formatted time in place of a number:
"1:23" means 1 minute and 23 seconds, and "1:23:45" means 1 hour, 23 minutes, 45 seconds. If you just pass an integer, it is the number of seconds.
Special selectors
all
all returns all the songs in your library.
none
none returns an empty playlist.
Commands
p
p is like a play/pause button. If the player is paused, it unpauses. If the player is playing, then it pauses. If the player is stopped, then it starts playing. If you pass it a playlist, it will set the queue to that playlist and begin playing it.
q
q without any arguments returns the queue (the current playlist). If you call q with a playlist as an argument, it will replace the queue with that playlist.
stop
stop stops playback.
list
list with no arguments lists all the songs in your music library. If you pass it a playlist, it will list all the songs in that playlist.
artists
artists with no arguments lists all the artists in your music library. If you pass it a playlist, it will list all the artists in that playlist.
albums
albums with no arguments lists all the albums in your music library. If you pass it a playlist, it will list all the albums in that playlist.
genres
genres with no arguments lists all the genres in your music library. If you pass it a playlist, it will list all the genres in that playlist.
years
years with no arguments lists all the years in your music library. If you pass it a playlist, it will list all the years in that playlist.
mpd
mpd gives you an instance of the MPDClient object, which you can use to send any mpd command that isn't available in Listlace yet. This'll probably be removed once I actually implement all the commands.