Commit d5d57312 authored by Mike Sheldon's avatar Mike Sheldon

Remove unnecessary id -> username conversions when retrieving recent tracks

parent 82c0ada3
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -112,11 +112,21 @@ class Server {
return null;
}
if($userid) {
$username = uniqueid_to_username;
$userurl = Server::getUserURL($username);
}
foreach ($res as &$i) {
$row = sanitize($i);
$row['username'] = uniqueid_to_username($row['userid']);
$row['userurl'] = Server::getUserURL(uniqueid_to_username($row['userid']));
if(!$userid) {
$row['username'] = uniqueid_to_username($row['userid']);
$row['userurl'] = Server::getUserURL($row['username']);
} else {
$row['username'] = $username;
$row['userurl'] = $userurl;
}
if ($row['album']) {
$row['albumurl'] = Server::getAlbumURL($row['artist'], $row['album']);
}
......@@ -126,10 +136,10 @@ class Server {
$row['timehuman'] = human_timestamp($row['time']);
$row['timeiso'] = date('c', (int)$row['time']);
$row['id'] = identifierScrobbleEvent(uniqueid_to_username($row['userid']), $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id_artist'] = identifierArtist(uniqueid_to_username($row['userid']), $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id_track'] = identifierTrack(uniqueid_to_username($row['userid']), $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id_album'] = identifierAlbum(uniqueid_to_username($row['userid']), $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id'] = identifierScrobbleEvent($row['username'], $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id_artist'] = identifierArtist($row['username'], $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id_track'] = identifierTrack($row['username'], $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
$row['id_album'] = identifierAlbum($row['username'], $row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'], $row['artist_mbid'], $row['album_mbid']);
if ($userid) {
$row['loved'] = $adodb->CacheGetOne(60, 'SELECT Count(*) FROM Loved_Tracks WHERE artist='
......
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