Documentation
CreatePlugin
How to create plugin for Bluemindo ?
First, you should take a look at this file (the classes that load and manage both modules and plugins) :
src/extensionsloader.py and src/gui/extensionsconfig.py.
You can find all officials plugins at this directory:
src/plugins
There is a list of all signals that you can use in the src/extensionsloader.py file. Some of them are called on Bluemindo starting or on GUI events. The concept is to connect one of your function to a signal. Once the signal is loaded in the software, the function will be launched. You can also load one of these signals.
If you think you need another signal, please report a bug, at this URL : project/bluemindo/bugs
The 4 rules.
There are some rules you have to respect:
- the plugin have to be in the Bluemindo's unofficial plugins directory (by default $HOME/.local/share/bluemindo/unofficial_plugins)
- the plugin have to had at least an author, a licence and a description
- the plugin have to follow the XDG Base Directory Specification
- the plugin should use ConfigParser for configuration
The AboutDialog of your plugin is generated, you don't have to write it. The logo can be a GTK Stock Item or a file located in your plugin directory.
You are encouraged to read the code of existing modules and plugins to know more about Bluemindo. You can join the room bluemindo@conference.codingteam.net for more informations on Bluemindo hack :-)
Plugin example
Here is an example of a plugin that writes the title of the song in the console, when a new song is launched.
# -*- coding: utf-8 -*- # Bluemindo: A really simple but powerful audio player in Python/PyGTK. # Copyright (C) 2007-2009 Erwan Briand # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation version 3 of the License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from gtk import STOCK_FILE class Exampleplugin: def __init__(self, extensionsloader): self.extensions = extensionsloader self.plugin = {'name': 'Exampleplugin', 'version': 0.1, 'logo': STOCK_FILE, 'configurable': False, 'authors': 'Erwan Briand <erwan@codingteam.net>', 'license': 'GNU General Public License 3', 'description': 'Just an example'} def start_plugin(self): """Called to start the plugin.""" var = 42 # Connect to Bluemindo signal self.extensions.connect('OnPlayNewSong', self.play_new_song) def stop_plugin(self): """Called to stop the plugin.""" pass def play_new_song(self, song): """Called at each new song being played.""" artist = song[1] title = song[0] print 'Now playing: %s - %s' % (artist, title)
Additional informations
If you want to add a configuration interface to your plugin, you have to set self.plugin['configurable'] = True. You also have to use two signals: OnModuleConfiguration and OnModuleConfigurationSave.
A plugin `Exampleplugin` is in a directory named `exampleplugin`, that only have to contains a __init__.py (but you can add .py files or anything else ;-)).

Bluemindo