mpg - a bash script for cli control of mpg321
Written by jt - jt AT homis DOT org
I wanted a simple command-based interface for controlling mpg321 (play, pause, stop). This could be used with keyboard mappings, or from a desktop menu (e.g. the root menu in Openbox) to control music playback.
It is currently limited to playing a single song at a time (no queue/wildcard support in the filespec). The script doesn't use the else keyword because my bash version doesn't seem to support it.
Todo:
- Add switch for suppression of messages / mpg321 output
- Add wildcard/queue support?
The mpg source can be downloaded here {removed because it's currently broken and in need of fixing}; usage is explained below. Feel free to find/fix bugs, and to suggest/submit modifications.
mpg 0.1 - written by jt - jt AT homis DOT org - http://www.homis.org/ All code herein is public domain. Feel free to find/fix bugs and make improvements! Note that this relies on mpg321, which must be in your $PATH. Usage: mpg [OPTION] [FILESPEC] mpg is a bash script to ease cli control of mpg321 playback. p, --play FILESPEC start a new mpg321 process, playing FILESPEC a, --pause, pause (interrupt) playback; sends STOP signal to i, --interrupt mpg321 process, putting it to sleep u, --unpause, unpause (resume) playback; sends CONT signal to r, --resume mpg321 process, waking it up s, --stop, stop (quit) playback; sends INT signal to q, --quit mpg321 process, exiting it cleanly h, --help print this usage screen