Package: pympristui
pympristui (TUI MPRIS2 Control)This is a tiny little Python script to act as a TUI (Terminal User Interface)
to anMPRIS2-enabled
media player.  MPRIS is aD-Bus-based
interface which many Linux-based media players support, which allows external
applications to control some aspects of media playback.  This is most often
used to provide little audio applets for desktop environments, or to allow
web-based control of a media player.  This app is intended to provide some
basic controls when (for instance) SSHed in to a machine that's running an
MPRIS-compatible media player.This app has been tested in Python 3.9+, and requires:dbus-python(tested on 1.2.16)mpris2(tested on 1.0.2)urwid(tested on 2.1.2)It attempts to connect to theAudaciousMedia Player by default; to connect to another app instead, you'll have to specify
a commandline arg.InstallationI'd recommend using avirtual environmentto run the app.  Change to a directory where you want to store your venv,
and create/activate it with:$ python -m venv mpris2
$ . mpris2/bin/activateYou should have an(mpris2)prefix on your shell prompt to indicate the
venv is active.  Obviously feel free to name it whatever you like.pip InstallationAt this point, you can just install using:$ pip install pympristuiApympristui.pyscript should now be available on your$PATH.Manual InstallationOtherwise, check out the project from git, or download and uncompress an
archive from github.  Then, switch over to this project's dir and install
dependencies, either through:$ pip install -r requirements.txtor by hand:$ pip install dbus-python mpris2 urwidThen run it direct from the CLI (or copy the script anywhere you like):$ ./pympristui.pyUsageIt's a very basic app.  By default it tries to find an MPRIS interface for
the media player Audacious.  If that's not found (or if that's not what you
want to use), you can use the-p/--programarg to specify another string
to search for.  The string matching here is extremely basic; it'll just pick
the first advertised interface name which matches the string you specify.  If
the specified string isn't found (or if Audacious isn't running, when no-phas been specified), you'll get a list of all available MPRIS interfaces found
on your system, on the commandline, with output like:Available Player URIs:
 - org.mpris.MediaPlayer2.firefox.instance319681
 - org.mpris.MediaPlayer2.audaciousTo use that-p/--programargument to connect to that Firefox instance, for
instance:$ ./pympristui.py -p firefox
$ ./pympristui.py --program firefoxUsinginstance319681or even319681would also match that Firefox instance.Once it's started, the app just provides the simple controls pause/play/stop,
next/previous track, and seeking, along with the basic information about what's
being played currently.  It only accepts keyboard input, with the following
keybinds:space- play/pausen- next trackp- previous track<- Seek 10 seconds back>- Seek 10 seconds forwards- stopq- quitNote that the "quit" key only quits the control app itself; the actual app
playing audio will continue to run as usual.Limitations/TODOI'd originally intended to provide support for MPRIS2'sTrackListinterface, but it turns out the Audaciousdoesn't provide that,
so I didn't look into it any further.  As such, control in the app is limited
to play/pause/stop, next, and prev.  There's no tracklist visibility, or ability
to hop around with any control other than next/prev.I didn't implement volume control.The onscreen text just updates every second, so there'll often be a noticeable
(though brief) lag between hitting a command and having the info update onscreen.
The commands should be executed immediately, though.This has only been tested against Audacious.  If other MPRIS servers behave
differently (like maybe not including a total track time or something), this
might have problems.LicenseAll code in this project is licensed under thezlib/libpng license.  A copy is
provided inCOPYING.txt.Changelogv1.0.6- March 9, 2022More user-friendly messages when no MPRIS players can be foundMore user-friendly message when DBus error is encounteredAdded-V/--versionargumentv1.0.5- June 15, 2021Bah, one more case where missing MPRIS tags would crash the appv1.0.4- June 9, 2021Fixed a couple more cases where missing MPRIS tags would crash the appv1.0.3- May 7, 2021Fixed handling of cases where some tags (such as album) aren't presentv1.0.2- March 3, 2021Added forward/reverse seekingv1.0.1- February 26, 2021Use blue coloration forPausednotificationInclude version number in app headerFix up--helpoutput a bitv1.0.0- February 24, 2021Initial release