[PATCH] Plugin-like extensions for Amarok

Patryk Cisek patryk at prezu.one.pl
Tue Sep 4 13:28:27 UTC 2007


Hi all, 

Recently I decided to write a LIRC client plugin for Amarok. Then I ealized,
that there's no plugin loader for such external module-like plugins, so I 
embedded it into Amarok. 

However this approach is not good -- many people don't care about LIRC and 
don't use it. For them dependency on liblircclient is just a waste of 
resources and time. Well, I decided to write a plugin loader and then 
rewrite LIRC client as a separate plugin. 

To avoid confusion with Plugin class (src/plugin/plugin.h/cpp) I called hese
modules "extensions" (of course name can be changed). I was inspired by 
modules mechanism from Kadu project (http://kadu.net). They load/unload 
these plugins -- which are simply shared libraries -- during runtime. They 
added modules mechanism to Kadu about 2-3 years ago. After that many people 
(including myself) joined project to write their own modules. 

My mechanism here is little different -- Kadu has it's own Library class, 
which handles all lower level ldopen stuff it self. Instead I used KDE's 
KPluginLoader schema. 

Thanks to installing also all .h files to $KDEDIR/include/amarok one can 
write extensions as a completely separate projects. As an example I wrote 
the LIRC client as part of Amarok (src/lirc directory in the patch file) and 
as a separate project (see patch tarball links below). Code for these two is 
completely the same. I just wanted to show how to write plugins as internal" 
and "external" project. 

Extensions manager along with "internal" LIRC client:
http://kadu.net/~patryk/amarok/extensions-2007-09-04.patch 

"External" LIRC client extension:
http://kadu.net/~patryk/amarok/amarok-lirc-2007-09-04.tar.gz 

This is not yet considered finished, but I'd like you guys to take a look
at this and tell what you think about the whole idea. Also some .h files
might be missing from src/CMakeLists.txt -- it's not "release version" yet,
so I wasn't careful to add all for sure. The above patch builds cleanly with 
708289 revision of Amarok -- due to frequent changes in .h files names some 
tweaks in src/CMakeLists.txt are often needed. 

 --
Patryk Cisek



More information about the Amarok mailing list