![]() |
![]() |
![]() |
Mex Reference Manual | ![]() |
---|
This section explains how to add your own extensions and customisations to Media Explorer.
What you need to know to extend Media Explorer can be summarised as "be a GNOME developer": most of the technologies you need to know are used in the GNOME project.
But, more specifically, you need to know:
How to use jhbuild. This is the easiest way to build a working development environment for Media Explorer (see below).
How to use autotools (to put together a plugin project)
How to code in C (to be able to write in a language which integrates with the Media Explorer app)
How to use GObject (to be able to subclass libmex classes to slot into Media Explorer)
How to write applications using Clutter+Mx (optional and not vital): to provide custom widgets for your plugin
The easiest way to work on Media Explorer is to use jhbuild-mex. This can build all the correct dependencies for Media Explorer, providing you are working on a relatively recent Linux distro (e.g. Debian sid or Fedora 14). You can get it from ???TODO. Installation and Media Explorer build instructions are included in that project.
Once you've installed jhbuild-mex and built Media Explorer, you can make local modifications to the Media Explorer source from inside a jhbuild-mex shell, e.g.
# work directly on the checked-out jhbuild source; see # below for caveats$
cd $JHBUILD_MEX_SOURCE/media-explorer$
git co -b my-shiny-new-branch # ...edit source code and make local commits using your editor of choice...$
jhbuild-mex shell$
make # to install your version of mex over the stock version$
make install
You only need to be inside the jhbuild-mex shell when you want to build the source; but it's often easiest to just stay inside a shell all the time so you don't forget to switch before building.
If you run jhbuild-mex build after making modifications to the source, your branch will be used as the basis for the build. So if you are working on your own branch, you will need to merge any changes made to mex master into your own branches yourself.
You should also be aware that if you choose to clear the source directory during a jhbuild-mex build (one of the options if a module fails to build), any local changes you've made could be lost. So it's a good idea to push your own branches to a remote git server as a backup.
Another useful tool is turbine, which provides a GUI for creating GObject classes. This can help a lot when writing Media Explorer plugins (which are, naturally, GObject classes). You can get turbine from GNOME git.
The default jhbuild-mex configuration builds a minimal version of the application and its support libraries, with most of the Grilo plugins disabled (for various licensing reasons). This means that you can't make use of Grilo to feed media from other sources like Flickr, YouTube and Vimeo into Media Explorer.
However, you can re-enable Grilo plugins by changing the default configure options, then adding the plugins to the Media Explorer search whitelist. Then, providing the user supplies the necessary API keys, results from these extra sources should appear in Media Explorer's search results display.
The following Grilo plugins can provide search results to Media Explorer:
jamendo. For accessing free music from Jamendo.
upnp. For accessing media on UPnP servers. Although grilo-tracker + tracker-upnp (both enabled in Media Explorer by default) provide access to UPnP media, the Grilo UPnP plugin is an alternative way to index UPnP media. It may be useful if you are using Media Explorer on a system where Tracker isn't available.
vimeo. For accesing videos on Vimeo.
youtube. For accessing videos on YouTube.
flickr. For accessing photos on Flickr.
Grilo has various other plugins, and doubtless more will be added over time, but the ones listed above are the only ones which affect Media Explorer searches.
You can set configure options for the build via jhbuild-mex
by editing the $HOME/.jhbuildrc-mex-custom
file. Add a line to customise the arguments passed to
autogen.sh; this in turn affects how
configure is invoked.
For example, to turn on the vimeo and youtube plugins, the line would look like this:
1 |
module_autogenargs['grilo-plugins'] = '--enable-upnp --enable-vimeo' |
To enable other modules, append --enable-$MODULE
to the autogenargs string, where $MODULE
is one
of the module names from
It's also possible to disable a plugin. You might want to
do this if a plugin is causing Media Explorer to crash (as the
YouTube plugin has done on occasion in the past). To do this,
just pass --disable-$MODULE
as an autogen argument.
For example, to enable upnp and vimeo but disable youtube:
1 2 3 |
module_autogenargs['grilo-plugins'] = '--enable-upnp \ --enable-vimeo \ --disable-youtube' |
Once a Grilo plugin has been enabled, the next step is to allow Media Explorer to use it as a content source. Once you've done this, any searches made through the Media Explorer interface will also search the enabled content sources (as well as the local filesystem and UPnP via the grilo-tracker plugin).
To enable a Grilo plugin as a Media Explorer content
source, modify your $HOME/.config/mex/mex.conf
configuration file (create this file if it doesn't exist). Here's
an example:
1 2 |
[grilo-plugins] enabled=grl-tracker;grl-vimeo;grl-flickr;grl-jamendo |
Note that the plugin ID is a name shown in
the
previous list, prefixed with grl
. You
can enable more plugins by appending a semi-colon and a plugin
ID to the value for enabled
.
Once you've enabled new plugins in Grilo and whitelisted them, you may still need to configure them by following these instructions.
You can test which Grilo plugins are available
by running mex from inside a jhbuild-mex
shell, with Grilo registry debugging turned on. Use the
GRL_DEBUG
environment variable to control
which messages Grilo displays, and at which log levels.
Full debugging for the plugin registry is enabled like this:
$
GRL_DEBUG=plugin-registry:debug mex
A plugin logs a message like this if it loads successfully:
(mex:31977): Grilo-DEBUG: [plugin-registry] grl-plugin-registry.c:173: Plugin rank 'grl-jamendo' : 0 (mex:31977): Grilo-DEBUG: [plugin-registry] grl-plugin-registry.c:370: New source available: 'grl-jamendo' (mex:31977): Grilo-DEBUG: [plugin-registry] grl-plugin-registry.c:577: Loaded plugin 'grl-jamendo' from '/home/ell/mex/install/lib/grilo-0.1/libgrljamendo.so'
Make sure you have
(mex:31866): Grilo-DEBUG: [plugin-registry] grl-plugin-registry.c:173: \ Plugin rank 'grl-vimeo' : 0 (mex:31866): Grilo-WARNING **: [vimeo] grl-vimeo.c:103: Missing configuration (mex:31866): Grilo-WARNING **: [plugin-registry] grl-plugin-registry.c:551: \ Failed to initialize plugin: './../lib/grilo-0.1/libgrlvimeo.so'
Finally, confirm that the Grilo plugin is supplying content to Media Explorer by performing a search. Check that the search results contain columns for the plugins you've enabled. For example, this screenshot shows results being returned from Jamendo, Flickr, Tracker (local filesystem and UPnP), and Vimeo: