domenica 13 settembre 2009

Plug your model in! [MediaCenter]

Howdy people,
it's been a while now! :)

As promised my efforts in Media Center Components for Plasma didn't stop with the end of the GSoC. As probably some of you might remember I planned to make the mediabrowser extensible via plugins in order to allow different kind of browsing for your favourite media types (pictures, videos, audio tracks). Well, as from revision 1022813 of trunk this is now possible :)
Let's see what has changed so far.

MediaBrowser API
In order to have a good plugin system behind MediaBrowser an API was needed of course. Now we have it, let's see what it is about.
Since the navigation through media files is basically done through an ItemView the easiest way to allow extending the browsing behavior seemed to me the possibility to give different QAbstractItemModel's to the view. And this is done via the new class ModelPackage. ModelPackage defines some useful method the MediaBrowser applet will take advantage of in order to allow changing the navigation type on the go.
Let's see the most important methods.

  • virtual QAbstractItemModel *model() = 0: this method is of course pure virtual since the applet really needs it :p. Not much explanation about it. You simply need to return a vaild QAbstractItemModel that will be used by the view in order to display the items.
  • virtual BrowsingType browsingType() = 0: this method is used to determine the browsing type which can be either LocalBrowsing or RemoteBrowsing. Currently the view makes some assumption on the model and has a sort of privileged behavior for KDirModel's, so this method is needed to determine the correct behavior. Currently the model assumption is made on a qobject_cast rather than on this method though.. I plan to change this behavior..
  • virtual void createConfigurationInterface(KConfigDialog *parent): this is clearly taken from Plasma::Applet and has the same functionality: provide a sane way for configuring the model :)
  • signal modelReady(): this signal is really needed by MediaBrowser in order to know when the model is ready to be used by the view. This has appeared to be really needed for the KDirModel when calling openUrl on the lister. So, please, remember to emit this signal whenever you feel the model is ready to be used by the view.
For further methods please refer to the docs :)
Currently I've always ported the "built-in" KDirModel to the plugin system writing a LocalFiles plugin that simply shows your local files filtering them basing on the mimetype in order to only show media types :p.

MediaBrowser will simply show you the available plugins at startup allowing you to choose what browsing type you prefer. And that should work as expected :p.


I think this is a relevant step forward in MediaCenter since this will allow browsing your favorite media content web services simply through MediaCenter avoiding to use your web browser (/me stares at kde-silk :p).

So, now that we have a pretty working plugin system, why don't you help me writing a nice model for YouTube? We already have a DataEngine for that that, of course, needs some love :p.
In addition to that, I'd also like to point out a new DataEngine that soon will join MediaCenter: PicasaEngine. Francesco Grieco has written an useful engine to fetch contents from Picasa and I hope he'll also write a valid model for that in order to allow MediaBrowser explore Picasa's pictures :)

Looking forward for hearing your opinions, insults and suggestions :)

Cheers

venerdì 21 agosto 2009

GSoC ends, MediaCenter continues...

As most of you may already know the firm pencils down date of the GSoC for this year was on Monday the 17th at the beginning of this week. So GSoC has come to his end also this year but as usual with KDE our projects will keep staying alive for long :). And this is the case also for the MediaCenter. But first of all I would like to say "thank you" to my friendly-always-ready-to-answer-my-questions Marco Martin a.k.a. notmart who has been so meaningful in helping me with my project.
[Edit: this is really the picture i wanted to show]

MediaCenter started has a playground for a series of components aimed at handling media contents on the desktop. It's still in its early phases of development but it already exposes a good API that allowed me to write this already-mostly-working implementation. The graphical aspect is maybe the least nice one since I still have to adapt everything to Nuno's mockup, but the core parts are already working as expected. I recently blogged about the mediacenter and not so much has changed visually but I've worked on fixing some really annoying issues. In addition to this i gave a first basic implementation of the keyboard navigation for the mediabrowser. Actually, as notmart made me notice, MediaCenter shouldn't be designed only to be installed on a PC but, mostly, it should be designed for being used on a TV. That's why having an applet mouse-dependent is not so nice for a TV MediaCenter :p.
Currently the mediabrowser is shown fullscreen when nothing is playing and i'll work on making it pluggable with different models as i probably announced in my last post. The use of plugins will allow developers to write their own model exploring a specific source of medias. I think i'll work on the YouTube model as I already wrote a youtube engine for it. This way the browser will allow the user to choose which model to use in the current session of the mediacenter, which is pretty nice imho :).

So, if it's still not so clear, i'll continue my contribution to the mediacenter as long as it will need love and i'm sure the Plasma Team will support me in this =).

But that's it for now, stay tuned people :)

Mark this post as "read" :)

I'm just moving to blogspot and, of course, this is a test post. So feel free to ignore it and sorry if this upsets you.

Cheers =)