git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 860c9a3d authored by Mike Sheldon's avatar Mike Sheldon

Merge branch 'master' of gitorious.org:~Elleo/foocorp/elleos-gnu-fm

parents 363c2f0e d19bc9c5
...@@ -12,18 +12,18 @@ Description: | ...@@ -12,18 +12,18 @@ Description: |
Configure: none Configure: none
Builder: qtc5 Builder: qtc5
PkgConfigBR: PkgConfigBR:
- sailfishapp >= 0.0.10
- Qt5Core
- Qt5Qml
- Qt5Quick - Qt5Quick
- Qt5Qml
- Qt5Core
- sailfishapp >= 0.0.10
Requires: Requires:
- sailfishsilica-qt5 >= 0.10.9 - sailfishsilica-qt5 >= 0.10.9
Files: Files:
- /usr/share/icons/hicolor/86x86/apps
- /usr/share/applications
- /usr/share/harbour-librefm
- /usr/bin
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/%{name}/qml'
- '%{_bindir}' - '%{_bindir}'
- '%{_datadir}/%{name}/qml'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- /usr/bin
- /usr/share/harbour-librefm
- /usr/share/applications
- /usr/share/icons/hicolor/86x86/apps
...@@ -113,6 +113,7 @@ $method_map = array( ...@@ -113,6 +113,7 @@ $method_map = array(
'tag.getinfo' => method_tag_getInfo, 'tag.getinfo' => method_tag_getInfo,
'track.addtags' => method_track_addTags, 'track.addtags' => method_track_addTags,
'track.removetag' => method_track_removeTag, 'track.removetag' => method_track_removeTag,
'track.getinfo' => method_track_getInfo,
'track.gettoptags' => method_track_getTopTags, 'track.gettoptags' => method_track_getTopTags,
'track.gettopfans' => method_track_getTopFans, 'track.gettopfans' => method_track_getTopFans,
'track.gettags' => method_track_getTags, 'track.gettags' => method_track_getTags,
...@@ -1137,6 +1138,31 @@ function method_track_removeTag() { ...@@ -1137,6 +1138,31 @@ function method_track_removeTag() {
} }
/**
* track.getinfo : Get general information about a track.
*
* ###Description
* Get further information about this track.
*
* ###Parameters
* * **artist** (required) : Name of the track's artist.
* * **track** (required) : Name of the track.
* * **username** (optional) : User to get track info for (e.g. whether loved or not)
* ---
*
* @package Webservice
* @subpackage Track
* @api
*/
function method_track_getInfo() {
if (!isset($_REQUEST['artist']) || !isset($_REQUEST['track'])) {
report_failure(LFM_INVALID_PARAMS);
}
$xml = TrackXML::getInfo($_REQUEST['artist'], $_REQUEST['track'], $_REQUEST['username']);
respond($xml);
}
/** /**
* track.gettoptags : Get the top tags for a track. * track.gettoptags : Get the top tags for a track.
* *
......
...@@ -64,6 +64,33 @@ class TrackXML { ...@@ -64,6 +64,33 @@ class TrackXML {
return $xml; return $xml;
} }
public static function getInfo($artist, $name, $username) {
global $adodb;
try {
$track = new Track($name, $artist);
} catch (Exception $e) {
return(XML::error('failed', '7', 'Invalid resource specified'));
}
$xml = new SimpleXMLElement('<lfm status="ok"></lfm>');
$root = $xml->addChild('track', null);
$root->addChild('name', $track->name);
$root->addChild('mbid', $track->mbid);
$root->addChild('url', $track->getURL());
$root->addChild('duration', $track->duration * 1000);
$streamable = $root->addChild('streamable', $track->streamable);
$streamable->addAttribute('fulltrack', $track->streamable);
$root->addChild('listeners', $track->getListenerCount());
$root->addChild('playcount', $track->getPlayCount());
if($username) {
$userid = $adodb->GetOne('SELECT uniqueid FROM Users WHERE '
. 'username = ' . $adodb->qstr($username));
$root->addChild('userloved', $track->isLoved($userid) ? 1 : 0);
}
return $xml;
}
public static function getTopTags($artist, $name, $limit, $cache) { public static function getTopTags($artist, $name, $limit, $cache) {
try { try {
......
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