We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 51497e11 authored by Mike Sheldon's avatar Mike Sheldon

Add web service method for retrieving an artist's flattr uid (artist.getFlattr)

parent 952742dd
......@@ -79,6 +79,7 @@ $method_map = array(
'artist.getinfo' => method_artist_getInfo,
'artist.gettoptracks' => method_artist_getTopTracks,
'artist.gettoptags' => method_artist_getTopTags,
'artist.getflattr' => method_artist_getFlattr,
'album.addtags' => method_album_addTags,
'album.gettoptags' => method_album_getTopTags,
'user.getinfo' => method_user_getInfo,
......@@ -221,6 +222,14 @@ function method_artist_getTopTags() {
respond($xml);
}
function method_artist_getFlattr() {
if (!isset($_GET['artist'])) {
report_failure(LFM_INVALID_PARAMS);
}
$xml = ArtistXML::getFlattr($_GET['artist']);
respond($xml);
}
/**
* Album methods
......
......@@ -112,6 +112,23 @@ class ArtistXML {
return $xml;
}
public static function getFlattr($artistName) {
$artist = new Artist($artistName);
if(!$artist) {
return(XML::error('failed', '7', 'Invalid resource specified'));
}
$xml = new SimpleXMLElement('<lfm status="ok"></lfm>');
$root = $xml->addChild('flattr', null);
$root->addAttribute('artist', $artist->name);
$root->addChild('flattr_uid', $artist->flattr_uid);
return $xml;
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment