I just started playing with QtScript in Amarok 2.0.1.1 and so far the documentation has been a big let down. A lot of things are documented for C++ but the conversion into JavaScript is a lot trickier then it looked.
This is ofcourse because the whole QtScript engine is all new and this will become better over time. In this posting I will show what the TrackInfo object holds, which is returned by Amarok.Engine.currentTrack();
destroyed(QObject*): function () { [native] }
destroyed(): function () { [native] }
deleteLater(): function () { [native] }
objectName:
title: Hotaka (radio edit)
sampleRate: 44100
bitrate: 192
score: 49.5
rating: 0
inCollection: true
type: mp3
length: 215
fileSize: 5195160
trackNumber: 1
discNumber: 0
playCount: 1
playable: true
album: Hotaka
artist: Juno Reactor
composer:
genre: Electronic
year: 2002
comment: DHA's Music Archive
path: /mnt/music/Mp3/Albums2/Juno Reactor/Juno Reactor - Hotaka/01 Hotaka (radio edit).mp3
isValid: true
isEditable: true
lyrics: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Juno Reactor Hotaka (radio edit) lyrics</title>
</head>
<body><h3><a href='http://lyricwiki.org/Juno_Reactor:Hotaka_%28radio_edit%29'>Hotaka (radio edit)</a> by <a href='http://lyricwiki.org/Juno_Reactor'>Juno Reactor</a></h3>
<pre>
Not found</pre><hr/>Additional Info:
<ul>
<li><strong>url: </strong><a href='http://lyricwiki.org/index.php?title=Juno_Reactor:Hotaka&action=edit' title='url'>http://lyricwiki.org/index.php?title=Juno_Reactor:Hotaka&action=edit</a>
</li>
</ul>
</body>
</html>
So the next time you need some information about the currently playing track you know exactly which fields are available.On a side note: the isValid boolean tells you if the track info you are parsing is in fact a running track. If Amarok is not playing all fields will be empty or zero. Check isValid before you start processing an empty data object...
Last Updated ( Tuesday, 27 January 2009 15:09 )