Commit f1035cce authored by Elliott Eggleston's avatar Elliott Eggleston

Fix parameters for RemoteUser::getScrobbles

Make it match parent class, use 'from' and 'to' parameters
parent f12853d6
......@@ -107,11 +107,20 @@ class RemoteUser extends User {
*
* @param int $number The number of scrobbles to return
* @param int $offset The position of the first scrobble to return
* @param int $from Only return scrobbles with time higher than this timestamp
* @param int $to Only return scrobbles with time lower than this timestamp
* @return array An array of scrobbles with human time
*/
function getScrobbles($number, $offset = 0) {
function getScrobbles($number, $offset = 0, $from = false, $to = false) {
$page = (int) $offset / $number + 1;
$xml = $this->getXML('?method=user.getRecentTracks&user=' . $this->username . '&limit=' . $number . '&page=' . $page);
$url = '?method=user.getRecentTracks&user=' . $this->username . '&limit=' . $number . '&page=' . $page;
if ($from) {
$url .= '&from=' . $from;
}
if ($to) {
$url .= '&to=' . $to;
}
$xml = $this->getXML($url);
$tracks = array();
foreach($xml->recenttracks->track as $xmltrack) {
$track = array();
......
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