An mplayer/mpv 'controller' script built for internet streaming.
Ztream is a Zsh script for controlling an mpv instance (or a mplayer instance in theory, but this isn't well tested). It was written as a small excercise in mastering Bash-ish shell scripting.
- mpv (or mplayer, if you're feeling adventurous)
- dmenu (for station selection etc, optional if you only want the simplest use case)
All configuration is done via editing the source the source. Available options are noted at the top of the file.
PLAYERshould be the name (or path) of a compatible player in your $PATH
PLAYER_OPTSshould be options to pass to
$PLAYER. If using mplayer, you will need to remove the default (as mplayer has no
LAST_STATION_PATHshould be a path to a file that will have the playing station written to it on station change.
FIFOis simply an indicator as to whether or not a controlling FIFO will be opened to the underlying player
FIFO_PATHis where the FIFO should be placed
stationsis an associative array of station name to station url (or mpv/mplayer option). The url is simply appended to the command.
ztream action [station name]
Possible actions are:
- Change: To change the station. Either requires a secon option (a station name) or dmenu to present the options.
- Random: To select a random station from the available stations.
- Last: To start playing the last station that was played (as indicated in the file written in
$LAST_STATION_PATH) If no last station is found, this action will play a random station.
- Stop: To kill the mpv instance. This action will kill all instances of
Nothing (Ztream feels pretty finished. If you've any ideas, please contact me and we can talk :) )