-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was attempting to add libre.fm support in the Chrome audioscrobbler plugin (it is hard coded to use last.fm right now).
While testing the plugin with libre.fm I noticed that the track.getInfo API method does not return the artist as expected and this causes the plugin using the API to fail to identify the track artist. I have attached a proof of concept patch that I believe should fix the API. I have not tested this code, but it should demonstrate what I believe is wrong, if nothing else. Relevant API page: http://www.last.fm/api/show/track.getInfo Relevant Github issue for the Chrome extension: https://github.com/david-sabata/web-scrobbler/issues/37 Example API URL: https://libre.fm/2.0/?method=track.getinfo&autocorrect=1&artist=Molly%20Lewis&track=I%20Pity%20the%20Fool - -- Trey Hunner http://treyhunner.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT6GVIAAoJEOpnfp/Nreon6PsH/1VyjIRodwmdNwajrf3UXZWF +u7FZUOeGZOUPOg3vThs/2QfvjXCKKnPLY8WEK4nwqe+3SJq1gtLsboecKmkn3g8 2SLv9bUb7QpYK3F2cmUXbRF9iCiGilC4qJSZslJWA+sPqKXhSXgj72XxHQsBpzdA TF5Ig+4u5Rt7DFkPqJlAUWp6bXhkYjwU7JOtraRPZ4b2RAdYca/kf7NCxJ4Rzpd6 SOkczLo9oBXCf5aItin1yjbpsfcDhQgkS54Z3RZdE2bZhP2FEV9euQIXyVmZjDtz CeK1aC2FLTYDZLuGqhzGzrAZcc3loWbsMpPkjzOwGwladxKpmzXD5iZNztBQNKw= =Mgq+ -----END PGP SIGNATURE-----
>From cf3569aebd637c76d3aa019f0dbbbb1f65569628 Mon Sep 17 00:00:00 2001 From: Trey Hunner <[email protected]> Date: Sun, 10 Aug 2014 23:39:01 -0700 Subject: [PATCH] Add artist XML to track.getInfo --- nixtape/api/TrackXML.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nixtape/api/TrackXML.php b/nixtape/api/TrackXML.php index 62ade96..7e163a7 100644 --- a/nixtape/api/TrackXML.php +++ b/nixtape/api/TrackXML.php @@ -69,6 +69,7 @@ class TrackXML { try { $track = new Track($name, $artist); + $artist = $track->getArtist(); } catch (Exception $e) { return(XML::error('failed', '7', 'Invalid resource specified')); } @@ -83,6 +84,11 @@ class TrackXML { $streamable->addAttribute('fulltrack', $track->streamable); $root->addChild('listeners', $track->getListenerCount()); $root->addChild('playcount', $track->getPlayCount()); + $artistXml = $xml->addChild('artist', null); + $artistXml->addChild('name', $artist->name); + $artistXml->addChild('mbid', $artist->mbid); + $artistXml->addChild('url', $artist->getURL()); + if($username) { $userid = $adodb->GetOne('SELECT uniqueid FROM Users WHERE ' . 'username = ' . $adodb->qstr($username)); -- 1.9.1
