[Feedback] DBus Interface Needed Enhancements
slaout at linux62.org
slaout at linux62.org
Sat Aug 4 17:23:21 UTC 2007
Sébastien Laoût sent a message using the contact form at
http://amarok.kde.org/en/contact.
Hello all,
I'm the developer of Kirocker Music Display.
It is both a Kicker applet and a full screen display to show the currently
playing music (ablum title / cover art, album, track, rating...) and
letting people to control their player (Pause, Next, Previous, Assign
rating...).
In the future (in KDE 4), I plan to also make it a Plasmoid to show it on
the desktop as well as on the panel, but also make it a screensaver, or a
screensaver replacement (displaying instead of the screensaver, only if
something is playing).
http://www.kde-apps.org/content/show.php/Kirocker+Music+Display?content=52869
While doing this program, I perceived some frustration in regard to the
Amarok DCop API.
I'm not mailing to complain, but to make constructive criticisms, and a
proposal for a better DBus interface in Amarok 2, so that all new Amarok
scripts and extensions can come to life, extending the Amarok user base,
and making them happier.
And after all, if you are about to add Plasmoids onto Amarok itself, I
think the extension of the scripting API is a mandatory point, so here is
my experience with the current one to get the 2.0 one better:
*** DBUS SIGNALS ***
To know in real time if Amarok is playing/paused/stopped, to get informed
of track change, position change, of volume change, of... any change, I had
to opt to poll Amarok three times a second. This is ressource consuming and
laptop batery consuming. I would also like to be informed of "random mode"
change, but months after months I add new polls and other new polls in
those famous 3 times a second, and it's becoming to be a lot. I could check
for some information frenquently, for some others once a second... But this
complixify the code and make the applet less responsive.
=> Would be cool if Amarok triggered DBus signals when something changes,
including configurations.
=> Needed signals are:
- currentlyPlayingInformationChanged: any ID3 tag has changed, or rating,
cover, lyrics... Perhapse this signal should be splitted, because reloading
the cover or the lyrics can be ressource consuming
- statusChanged: playing / paused / stopped changed, random changed
- positionChanged: emitted every seconds, so that the displayed time will
be in sync with Amarok
- volumeChanged: this to add a volume slider in the full screen display.
People are able to use global keyboard shortcuts of Amarok to change the
volume, so I need to get the volume change to display it. And the Kicker
applet is duplicating most information of the Amarok OSD. I would disable
OSD, but there is still an information that is useful in the OSD: the
volume change. I would like to add the volume slider to the Kicker applet
too, shown only when mouse hovering on the applet, but ALSO shown a few
seconds when user is using global shortcut or scrolling Amarok system tray
icon to change volume. This will completely remove the need for the OSD,
for the best.
- playlistChanged: any information (rating, artisit, cover...) about
other songs (not currently playing) in the playlist changed, or if the
playlist itself changed.
*** GET FULL SIZE COVER ART ***
I had to build a lot of code to retreive the full size cover art, the
Last.fm cover art. I'm currently obliged to query the Amarok database to
get all available images, but I was too lazy to get the biggest one. I only
take the first one. Amarok should do the "compute which image is the bigged
one and return it" once and for all scripts, so all scripts are better
quality.
=> A single DBus call to always retreive the biggest album cover, from the
currently playing artist/album, as well as any artist/album couple (to
display next playing songs with theire album cover art).
=> And it should do so for any song, including Last.fm ones, podcasts,
magnatune (and other services)... would be also of a great help. Please do
not enforce script developers to modify their code each time a new source
is added (to support podcast album arts when it was introduced, and support
Last.fm a few month later when it was added in a new Amarok release, and
release a new script version that support Magnatune covers when it's
introduced in the last Amarok version, etc).
=> And, by the way, the "nocover.png" image is too small to display in
full screen mode: it looks very pixelized. I hope it will be made SVG for
Amarok 2, so that I can display covers at any user configurable size.
*** RETREIVE LYRICS FOR ALL SONGS, ANYWHEN ***
Some information like lyrics are only retreivable in specific moments.
Only when the user has opened the Lyrics panel. And I have to poll
regularily because the lyrics retreiveing is not instantaneous, and there
is no signal when it's ready. This feature is not available yet in Kirocker
Music Display, but I plan to add it in the next version. I will have to
display a message "Please open the Lyrics panel, and if asked, click one of
the proposed lyrics" when nothing is available, and poll every seconds to
see if it has changed.
=> I would need two DBus calls: one to retreive the lyrics of a song, and
if the result is a list of available lyrics, I display that list to the
user and call a second DBus call to inform Amarok of the user choice.
*** LAST.FM METHODS ***
When listening to a Last.fm stream, Previous/Pause/Next has no meaning
anymore. And obviously, Next should trigger the Skip Last.fm action. Having
Ignore and Love actions would also be a very minimum. I would want to
replace the three Previous/Pause/Next buttons by Ignore/Love/Skip when
playing a Last.fm stream.
=> Add three DBus calls to Ignore/Love/Skip Last.fm functions
*** ENHANCED PLAYLIST QUERY ***
There is no way to get a playlist item at position x. So, to be able to
know what are the two next playing songs, I used the Amarok Full Screen
hack: ask Amarok to save the current playlist to XML, ask the current
position in the playlist and parse the XML. It's a bit heavy to do all
those computations (and more: retreive new cover, new informations, one by
one) at every track change. We can feel a small delay because of that.
=> There should be calls to retreive all information of a playlist item at
once, under some cheap text format. For instance, I'm signaled the track
change, I only have to call the DBus "int i = dbus(amarok
getPlayingPosition)" and then "dbus(amarok getTrackInformation i)" (in
pseudo language) and this second call returns
"Track:***\nArtist:***\nfullCover:***\nRating:\n***". This is very cheap:
only one IPC, no XML parsing, all information are one line of text, so I
can split with "\n" and then take everything before the ":" ass the key,
and everything after as the value. This "all in one" call is a "bonus", to
optimize computations in critical moments like track changing.
*** EXPORTING VISUALIZATIONS ***
People keep asking for visualisation in the full screen display. And this
request will be getting more and more important with Plasma when people
will want visualisation on the desktop or on a Plasma screensaver.
I told them it's not possible because only Amarok has the needed
information (tone/volume/frenquency diagram) to display that and passing
that through DCop/DBus is not realistic (asking that tousand times per
seconds).
But I found a solution. A very elegant solution.
=> Amarok should store the frequencies information in a shared memory.
Amarok write the array of frequencies and other applications read it
hundred of times per second as if it was in theire process memory without
any problem. It's very nice, and it will let other applications like
Kirocker Music Display to display the visualization the same way and speed
as Amarok itself.
*** ADDITIONAL REQUESTS ***
Here are a few calls that would be good to have, for the sake of API
completeness:
=> stopAfterCurrentTrack(bool) : I could provide a Pause drop-down button,
with Stop, Stop After Current Track... This drop-down button is an easy way
to add advanced features (like Stop After Current Trackà or rarely useful
ones (like Stop) without cluttering the full screen interface or the
size-constrained applet.
=> seekRelative() should work even when paused (wrong position)
=> A way to get the Wikipedia page of the artist
Best regards,
Sébastien Laoût.
More information about the Amarok
mailing list