{"id":301,"date":"2009-01-27T14:00:13","date_gmt":"2009-01-27T14:00:13","guid":{"rendered":"http:\/\/blog.cyberwizzard.nl\/?p=301"},"modified":"2016-03-17T21:23:39","modified_gmt":"2016-03-17T20:23:39","slug":"amarok2-trackinfo-object-in-qtscript","status":"publish","type":"post","link":"https:\/\/blog.cyberwizzard.nl\/?p=301","title":{"rendered":"Amarok2 TrackInfo object in QtScript"},"content":{"rendered":"<p>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.<\/p>\n<p>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();<\/p>\n<pre> 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: &lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;  &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;  &lt;head&gt;  &nbsp;&nbsp;&nbsp; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=utf-8&quot; \/&gt;  &nbsp;&nbsp;&nbsp; &lt;title&gt;Juno Reactor Hotaka (radio edit) lyrics&lt;\/title&gt;  &lt;\/head&gt;  &lt;body&gt;&lt;h3&gt;&lt;a href='http:\/\/lyricwiki.org\/Juno_Reactor:Hotaka_%28radio_edit%29'&gt;Hotaka (radio edit)&lt;\/a&gt; by &lt;a href='http:\/\/lyricwiki.org\/Juno_Reactor'&gt;Juno Reactor&lt;\/a&gt;&lt;\/h3&gt; &lt;pre&gt; Not found&lt;\/pre&gt;&lt;hr\/&gt;Additional Info: &lt;ul&gt; &lt;li&gt;&lt;strong&gt;url: &lt;\/strong&gt;&lt;a href='http:\/\/lyricwiki.org\/index.php?title=Juno_Reactor:Hotaka&amp;amp;action=edit' title='url'&gt;http:\/\/lyricwiki.org\/index.php?title=Juno_Reactor:Hotaka&amp;amp;action=edit&lt;\/a&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;\/body&gt; &lt;\/html&gt; <\/pre>\n<p> So the next time you need some information about the currently playing track you know exactly which fields are available.<\/p>\n<p> On a side note:&nbsp;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&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[459],"class_list":["post-301","post","type-post","status-publish","format-standard","hentry","category-programming","tag-not_ok"],"views":1731,"_links":{"self":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=301"}],"version-history":[{"count":1,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/301\/revisions"}],"predecessor-version":[{"id":433,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/301\/revisions\/433"}],"wp:attachment":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}