Scripts for playing MPD, Pandora, and radio stations.
mps
is a wrapper script for mpc/mpd that supports dynamic playlists.
pandora
is a script that plays pandora stations using pianobar in a tmux session.
radio
is a script that streams radio using mpv in a tmux session.
music
is a script that switches between the above scripts and manages
whichever one is active.
These scripts are designed with window managers in mind, and the documentation below has example configs for integrating them with i3, rofi, blezz, etc.
-
all: gettext (for envsubst), bash >=4.3
-
music: dmenu or a dmenu-compatible program such as rofi
-
mps: mpc
-
pandora: pianobar, tmux
-
radio: socat, jq, mpv, tmux
In addition, mps
requires access to MPD’s music directory.
On Arch Linux, grab the PKGBUILD from the GitHub repository and install using
makepkg
in the usual way.
On other distributions, you can install manually by copying the files in ./bin to your PATH, making them executable, and copying the file in ./etc to /etc .
There is also a Makefile available for package maintainers and advanced users.
Running any command from this project, e.g. music --help
, will create a
default config for you if one does not exist at ~/.config/music/config.ini
.
The default config has many comments explaining what each option does.
Use music mps
, music pandora
or music radio
to switch between music sources
and music play
to play the selected music source. You can also chain these
commands together, e.g. music radio play
will switch to the radio and start
playing it.
Running music
with no arguments will show some info about the current music
source. If pandora
or radio
are the current music source, it will attach
to a tmux session running pianobar
or mpv
, respectively. Use Ctrl+b to
detach from the tmux session.
You may find it useful to create a blezz menu for selecting a music source:
Music: act(m,Mpd, music mps play ) act(p,Pandora, music pandora play ) act(r,Radio, music radio play ) act(c,Choose, music choose )
Or an i3 mode:
set $exec exec --no-startup-id # music mode set $musicmode (M)PD, (P)andora, (R)adio, (C)hoose, (Esc) Cancel mode "$musicmode" { # mpd bindsym m $exec music mps play; mode "default" bindsym $mod+m $exec music mps; mode "default" # pandora bindsym p $exec music pandora play; mode "default" bindsym $mod+p $exec music pandora; mode "default" # radio bindsym r $exec music radio play; mode "default" bindsym $mod+r $exec music radio; mode "default" # choose bindsym c $exec music choose; mode "default" bindsym $mod+c $exec music choose; mode "default" # cancel bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+m mode "$musicmode"
Both snippets above also include a music choose
entry, which launches a
menu with dmenu where you can pick either a dynamic playlist, Pandora station, or
radio station depending on which music source is currently active.
The dynamic playlists are stored in ~/.config/music/mps-playlists
by
default. Here is an example playlist showing how they work:
https://raw.githubusercontent.com/DMBuce/music/master/example-playlist
The music
script also has commands for binding to media buttons. Below is an
example for doing that with i3. Use xev
to check the name of your media
buttons.
bindsym XF86AudioNext $exec music next bindsym XF86AudioPrev $exec music prev bindsym XF86AudioPlay $exec music toggle bindsym XF86AudioStop $exec music stop
Project documentation can be found in these files:
-
LICENSE - Terms and conditions
-
README - This document
The changelog can be viewed on GitHub at https://github.com/DMBuce/music/commits/master .