/mprand

Random-play for mpd

Primary LanguageTcl

mprand is a special-purpose mpd client to random-play from the entire mpd
database (currently only with uniform distribution). It improves upon one other
implementation of this concept of which I'm aware (Josh Kunz' ashuffle -
https://github.com/Joshkunz/ashuffle) in one major respect: it does not rely on
the deprecated 'listallinfo' mpd request (which can quickly become prohibitively
expensive with large databases over the network). It also ensures that there are
always at least two songs in the queue, so that playback is continuous (mpd's
gapless playback can function, and the built-in http streaming server will not
go down between songs); this also serves as a primitive yet elegant "up next"
feature. (ashuffle can do this, but does not behave this way by default.)

tkmprand expands on this concept by providing a GUI client for perpetual random
play, providing a status and up-next display and minimal transport controls,
automatically appending random songs to the queue so it never runs out.

The code mprand and tkmprand use to talk to MPD is factored into a package named
mpd_proto; this may prove useful as the nucleus of an MPD client library for
some other purpose. Expanding mpd_proto into a full MPD client library for Tcl
is a long-term goal.

USAGE

At the moment these scripts accept no options. mprand will, when executed, begin
random-playing on localhost:6600 (or the host and port specified by MPD_HOST and
MPD_PORT, if these environment variables are set). Random play continues until
another client stops playback, at which point mprand will terminate.

Note that the mpd_proto/ directory must be located somewhere in Tcl's package
search path; the easiest way to accomplish this is to set TCLLIBPATH="." or
something to that effect in the environment. Both scripts also require
simulation::random from tcllib, and tkmprand won't be able to display JPEG cover
art without Img (packaged as libtk-img on Debian and derivatives).

CAVEATS

Neither client supports connecting to MPD with a UNIX domain socket, since (to
my knowledge) the Tcl core doesn't support UNIX domain sockets.

SEE ALSO

ashuffle <https://github.com/Joshkunz/ashuffle> - Another special-purpose random-
play client as mentioned above.

mpd-sima <https://github.com/mxjeff/mpd-sima> - A general-purpose autoqueue client
with numerous possible queueing policies, including random behavior similar to
mprand and tkmprand.