Plugins
Current Official Plugins
- Trayicon - creates a trayicon in the panel that controls mpd.
- Audioscrobbler - shows similar artists to the one you are listening to.
- Coverviewer - downloads and displays album art.
- Logger - Writes the last N songs listened to a file.
- Autompd - automatically starts mpd on pympd startup.
- Stopbutton - adds the coveted stop button to pympd's controls.
- Embeddedart - displays coverart within the player mainview.
- Artisttracker - a visualization of your recent session (it's hard to explain).
How can I write a plugin of my own?
Read the specs below, look at the included plugins and start hacking away. It'll come to you, and hopefully you'll send it along to us.
Plugin Spec
How to write a plugin for pympd: revision 0.04 A plugin for pympd must have 5 variables defined in it: __class - class that controls the plugin (has the four functions defined below) __name - plugin name __author - plugin author __version - plugin version __blurb - a short description of the plugin. It's important to note that plugins are in their own scope, so they will not inherit the imported modules from pympd, they must import the modules themself. Four functions are needed in the plugin class: _init(self, data) param: data is a tuple of (gtk.glade.XML, gtk.Menu, pympdclient.pympdclient, base_dir, ConfigParser.ConfigParser) gtk.glade.XML = the glade XML object representing pympd gtk.Menu = the plugin menu on pympd pympdclient = a controller for pympd base_dir = the directory we are in (base directory) ConfigParser = the configuration parser for pympd, place config options here to get them included in ~/.pympd/pympd.conf usage: called when the plugin is loaded _spin(self, data, bool=None) param: data is mpdclient.Status (see below for data members) if bool is true, then the song has changed. usage: called every time pympd spins, it is useful for reacting to mpd data. _conf(self, bool=None) param: bool is a boolean. usage: If bool == None, we want to know if you have a dialog, otherwise we want your dialog to pop up. _unload(self) param: None usage: called when the plugin is unloaded, it is recommended to destroy all the gtk items created over here, so they are no longer persistant. recommended functions: buildPluginMenu(pluginMenu) add on to the plugin menu in the menubar on top, by appending onto the menu passed in init. buildConfig() build a config dialog, if your program needs it. mpdclient.Status: (taken from mackstann's mpdclient.py) class Status(object): "Class representing the status of the player at a given point in time." volume = -10 repeat = -1 random = -1 playlistLength = -1 playlist = -1L state = -1 song = 0 songid = 0 elapsedTime = 0 totalTime = 0 updating_db = 0 xfade = 0