Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Python
Tree: 09fc3b5d78

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
COPYING
README.md
mpn
mpn.py
setup.py

README.md

MPNotifier

Description

MPNotifier is a lightweight client for MPD displaying a popup notification each time a new song is played by the server. This kind of notification is usual for most graphical MPD clients but if you prefer to use a text-mode client like ncmpc or pms, you need to use separate tool like MPNotifier.

This version is a fork by Bart Nagel adding various features and fixing bugs. A few of the added features:

  • an optional system tray icon showing play state
  • popup menu for that icon with basic playback controls
  • album art shown in the notifications and in miniature on the tray icon
  • remote control via signals

Showing album art is only available if the library directory tree is available on the local machine, whether physically local or mounted with NFS or similar, and when the album art files are named as MPNotifier expects (see below).

Prerequisites

The following python packages are needed:

  • gtk, glib, gobject
  • mpd
  • pynotify
  • yaml
  • Image
  • numpy

These can be installed in Ubuntu with the following command:

sudo aptitude install python-gtk2 python-imaging python-mpdclient python-notify python-numpy python-yaml

The prodecure may differ with different distributions or operating systems.

However, there exists a bug in the current MPD client library (as of version 0.3.0) which doesn't allow the noidle command to work properly. It's an easy fix and I've submitted a bug report and patch for this but it hasn't been merged yet so you'll have to patch your own python-mpd. It's easy to do:

git clone git://jatreuman.indefero.net/jatreuman/python-mpd.git
cd python-mpd
curl http://jatreuman.indefero.net/p/python-mpd/issues/attachment/3/0001-Skip-PendingCommandError-for-noidle-command.patch | git apply
sudo python setup.py install

Installation and running

Installation is optional (it'll run from its source directory). To install do the normal Python thing:

sudo python setup.py install

To run, execute its startup script. If installed that's just mpn, otherwise ./mpn if in the same directory.

Configuration

Options can be given on the command line (see mpn --help for details) or in a configuration file (or both). Options given in a configuration file override the defaults, and options given on the command line in turn override those.

MPNotifier will load the file ~/.mpnrc if it exists, which is a YAML file like this:

persist: True
timeout: 10
keys: False
icon_size: 64
music_path: /home/me/music
title_format: "%t"
body_format: |
    from <i>%b</i>
    by <b>%a</b>
play_state_icon_size: 0.5

If that file doesn't exist, mpnrc in the current directory is also tried.

None of the configuration keys are required, and any given settings override the defaults. The defaults can be shown by running mpn --show-defaults. That YAML output can be used as the starting point for a configuration file.

The fields have the same names as the long forms of the command line arguments, but with underscores instead of hyphens. Full details can be found in the help text (mpn --help), in which the defaults are shown after the influence of any configuration file.

Album art

To display album art (in notifications and as the system tray icon icon) the music_path option must be set via a configuration file or the --music-path command line option. Its value must point to the root of MPD's music library, which must be available on the local machine (whether physically local or mounted via NFS or similar). The configuration variable's default value is /var/lib/mpd/music, which is the library's default location on Ubuntu, so this may or may not already be correct for you.

MPNotifier then hopes to find an image file in the same directory as the currently playing song matching one of a long list of possibile filenames, including cover, front and album, with .png or .jpg suffixes and optionally with a . prefix. See the possible_cover_filenames function in the source code to see how the possibilities are built, and just edit the source if you use a scheme not covered.

If a suitable image isn't found a placeholder image of a CD will be used instead.

Download

This fork

Original MPNotifier

Licence

MPNotifier is free software, released under the term of the GPLv2+.

Something went wrong with that request. Please try again.