Commit 6135a00d authored by mattl's avatar mattl

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

parents dd6d0197 1abab498
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fm.libre.droid"
android:versionCode="4"
android:versionName="1.4">
android:versionName="1.5" android:versionCode="5">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".LibreDroid"
android:label="@string/app_name"
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Libre Droid</string>
<string name="tag_examples">Exemples: acoustique, allemand, piano, violon, français, etc.</string>
<string name="tagged_station">Stations avec les étiquettes suivantes:</string>
<string name="login">Ouverture de session</string>
<string name="password">Mot de passe:</string>
<string name="username">Nom d\'utilisateur:</string>
<string name="not_google_account">(Il ne s\'agit pas de votre compte Google)</string>
<string name="account_details">Détails de votre compte Libre.fm:</string>
<string name="no_account">Vous n\'avez pas de compte?</string>
<string name="register">Rendez-vous sur www.libre.fm pour vous inscrire et créer un compte gratuit.</string>
<string name="tag_stations">Stations thématiques</string>
<string name="loved_tracks">Les morceaux que vous avez aimé</string>
<string name="community_loved">Les morceaux que la communauté a aimé</string>
<string name="add_station">Ajouter une station</string>
<string name="sd_card_needed">Veuillez vous assurer qu\'une carte SD est bien insérée avant de télécharger des morceaux.</string>
<string name="finished_download">Téléchargement de &#171;%s&#187; terminé</string>
<string name="download_failed">Impossible de télécharger &#171;%s&#187;:</string>
<string name="downloading">Téléchargement de &#171;%s&#187; sur votre carte SD.</string>
<string name="quit">Fermer</string>
<string name="tuning_in">Patientez...</string>
<string name="playlist_failed">Impossible de traiter la liste de lecture:</string>
<string name="banned">Banni</string>
<string name="loved">Aimé</string>
<string name="no_content">Désolé, cette station ne semble pas avoir davantage de contenu.</string>
<string name="cant_connect">Impossible d\'établir une connexion au serveur libre.fm:</string>
<string name="login_failed">Nom d\'utilisateur ou mot de passe incorrect</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Libre Droid</string>
<string name="tag_examples">Örneğin akustik, Alman, piyano, keman, Fransız, vb.</string>
<string name="tagged_station">Şu şekilde etiketlenen istasyonlar:</string>
<string name="login">Giriş</string>
<string name="password">Şifreniz:</string>
<string name="username">Kullanıcı isminiz:</string>
<string name="not_google_account">(Bu Google hesabınız değildir)</string>
<string name="account_details">Libre.fm oturum detayları:</string>
<string name="no_account">Hesabınız yok mu?</string>
<string name="register">www.libre.fm sitesini ziyaret edip ücretsiz bir hesap edinebilirsiniz.</string>
<string name="tag_stations">Tematik istasyonlar</string>
<string name="loved_tracks">Sevdiğiniz parçalar</string>
<string name="community_loved">Camianın beğendiği parçalar</string>
<string name="add_station">İstasyon ekle</string>
<string name="sd_card_needed">Şarkı indirmeden önce SD kartınızın takılı olduğundan emin olunuz.</string>
<string name="finished_download">&quot;%s&quot; parçasının indirimi sona erdi</string>
<string name="download_failed">&quot;%s&quot; indirilemedi:</string>
<string name="downloading">&quot;%s&quot; SD kartınıza indiriliyor.</string>
<string name="quit">Kapat</string>
<string name="tuning_in">Bekleyiniz...</string>
<string name="playlist_failed">Çalma listesi açılamadı:</string>
<string name="banned">Yasaklandı</string>
<string name="loved">Beğenildi</string>
<string name="no_content">Üzgünüz, bu istasyonda daha fazla içerik yoktur.</string>
<string name="cant_connect">Libre.fm sunucusuna bağlanılamadı:</string>
<string name="login_failed">Şifre ya da kullanıcı ismi hatalı</string>
</resources>
......@@ -22,6 +22,7 @@ header('Content-type: text/html; charset=utf-8');
require_once('database.php');
require_once('utils/human-time.php');
require_once('temp-utils.php');
require_once('version.php');
?>
<!DOCTYPE html>
......@@ -55,7 +56,7 @@ require_once('temp-utils.php');
</ul>
<p>This server is powered by <a href="http://bzr.savannah.gnu.org/lh/librefm/">GNU FM</a> version <?php echo $version; ?></p>
<p>This server is powered by <a href="https://gitorious.org/foocorp/gnu-fm">GNU FM</a> version <?php echo $version; ?></p>
</body>
</html>
......@@ -83,7 +83,8 @@ if (isset($_POST['install'])) {
laconica_profile VARCHAR(255),
created INTEGER DEFAULT 0,
modified INTEGER DEFAULT 0,
journal_rss VARCHAR(255))',
journal_rss VARCHAR(255),
receive_emails INTEGER DEFAULT 1)',
'CREATE TABLE Groups (
id SERIAL PRIMARY KEY,
......@@ -334,7 +335,12 @@ if (isset($_POST['install'])) {
'INSERT INTO Relationship_Flags VALUES (\'muse\')',
'INSERT INTO Relationship_Flags VALUES (\'crush\')',
'INSERT INTO Relationship_Flags VALUES (\'date\')',
'INSERT INTO Relationship_Flags VALUES (\'sweetheart\')'
'INSERT INTO Relationship_Flags VALUES (\'sweetheart\')',
'CREATE TABLE User_Stats (
userid INTEGER REFERENCES Users(uniqueid) ON DELETE CASCADE,
scrobble_count INTEGER NOT NULL,
PRIMARY KEY (userid))'
);
foreach ($stage_one_queries as $query) {
......@@ -371,15 +377,56 @@ if (isset($_POST['install'])) {
}
}
$adodb->Execute("CREATE INDEX album_artistname_idx ON Album(artist_name)");
$adodb->Execute("CREATE INDEX scrobbles_artist_idx ON Scrobbles(artist)");
$adodb->Execute("CREATE INDEX scrobbles_time_idx ON Scrobbles(time)");
$adodb->Execute("CREATE INDEX track_artist_idx ON Track(lower(artist_name))");
$adodb->Execute("CREATE INDEX track_name_idx ON Track(lower(name))");
$adodb->Execute("CREATE INDEX track_streamable_idx on Track(streamable);");
$adodb->Execute("CREATE INDEX scrobbles_artist_idx on Scrobbles(lower(artist))");
$adodb->Execute("CREATE INDEX scrobbles_track_idx on Scrobbles(lower(track))");
$adodb->Execute("CREATE UNIQE INDEX groups_groupname_idx ON Groups(lower(groupname))");
$adodb->Execute("CREATE INDEX scrobbles_userid_idx ON Scrobbles(userid)");
if(strtolower(substr($dbms, 0, 5)) == 'pgsql') {
// MySQL doesn't support the use of lower() to create case-insensitive indexes
$adodb->Execute("CREATE INDEX album_artistname_idx ON Album(lower(artist_name))");
$adodb->Execute("CREATE INDEX track_artist_idx ON Track(lower(artist_name))");
$adodb->Execute("CREATE INDEX track_name_idx ON Track(lower(name))");
$adodb->Execute("CREATE INDEX track_streamable_idx on Track(streamable);");
$adodb->Execute("CREATE INDEX scrobbles_artist_idx on Scrobbles(lower(artist))");
$adodb->Execute("CREATE INDEX scrobbles_track_idx on Scrobbles(lower(track))");
$adodb->Execute("CREATE INDEX groups_groupname_idx ON Groups(lower(groupname))");
// PostgreSQL stored functions
$adodb->Execute("CREATE OR REPLACE LANGUAGE plpgsql;");
$adodb->Execute("CREATE FUNCTION update_user_stats_scrobble_count() RETURNS TRIGGER AS $$
DECLARE s_count int;
BEGIN
UPDATE User_Stats SET scrobble_count = scrobble_count + 1 WHERE userid = NEW.userid;
IF found THEN
RETURN NULL;
END IF;
BEGIN
-- userid not in User_Stats table, get current scrobble count from Scrobbles
-- and insert userid into User_Stats
SELECT COUNT(userid) into s_count FROM Scrobbles WHERE userid = NEW.userid;
INSERT INTO User_Stats(userid, scrobble_count) VALUES(NEW.userid, s_count);
RETURN NULL;
END;
END;
$$ LANGUAGE plpgsql;");
$adodb->Execute("CREATE TRIGGER update_user_stats_scrobble_count
AFTER INSERT ON Scrobbles
FOR EACH ROW EXECUTE PROCEDURE update_user_stats_scrobble_count();");
} elseif (substr($dbms, 0, 5) == 'mysql') {
$adodb->Execute("CREATE PROCEDURE update_user_stats_scrobble_count(uid INT)
main: BEGIN
DECLARE s_count INT;
UPDATE User_Stats SET scrobble_count = (scrobble_count + 1) WHERE userid = uid;
IF ROW_COUNT() > 0 THEN
LEAVE main;
END IF;
SELECT COUNT(userid) INTO s_count FROM Scrobbles WHERE userid = uid;
INSERT INTO User_Stats(userid, scrobble_count) VALUES(uid, s_count);
END main;");
$adodb->Execute("CREATE TRIGGER update_user_stats_scrobble_count
AFTER INSERT ON Scrobbles
FOR EACH ROW CALL update_user_stats_scrobble_count(NEW.userid);");
}
$adodb->Close();
......
......@@ -27,21 +27,26 @@ header('Content-Type: text/plain');
if (!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t'])) {
die("FAILED Required POST parameters are not set\n");
}
if (empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t'])) {
die("FAILED Required POST parameters are empty\n");
}
$session_id = $_POST['s'];
//trim parameters
$session_id = trim($_POST['s']);
$artist = trim($_POST['a']);
$artist = noSpamTracks($artist);
$track = trim($_POST['t']);
$track = noSpamTracks($track);
$MQsess = $adodb->qstr($session_id);
if (empty($session_id) || empty($artist) || empty($track)) {
die("FAILED Required POST parameters are empty\n");
}
$artist = $adodb->qstr($_POST['a']);
if (isset($_POST['b'])) {
$album = $adodb->qstr($_POST['b']);
} else {
$album = trim($_POST['b']);
$album = noSpamTracks($album);
}
if (empty($album)) {
$album = 'NULL';
}
$track = $adodb->qstr($_POST['t']);
if (isset($_POST['l']) && is_numeric($_POST['l'])) {
$length = (int) $_POST['l'];
if ($length > 5400) {
......@@ -53,24 +58,32 @@ if (isset($_POST['l']) && is_numeric($_POST['l'])) {
$expires = time() + 250; //Expire in 5 minutes if we don't know the track length
}
$mb = validateMBID($_POST['m']);
if ($mb) {
$mbid = $adodb->qstr($mb);
} else {
$mbid = validateMBID($_POST['m']);
if (!$mbid) {
$mbid = 'NULL';
}
//quote strings
$session_id = $adodb->qstr($session_id);
$artist = $adodb->qstr($artist);
$track = $adodb->qstr($track);
if($album != 'NULL') {
$album = $adodb->qstr($album);
}
if ($mbid != 'NULL') {
$mbid = $adodb->qstr($mbid);
}
//Delete this user's last playing song (if any)
$adodb->Execute('DELETE FROM Now_Playing WHERE sessionid = ' . ($MQsess));
$adodb->Execute('DELETE FROM Now_Playing WHERE sessionid = ' . ($session_id));
if (!check_session($MQsess)) {
if (!check_session($session_id)) {
die("BADSESSION\n");
}
try {
$adodb->Execute('INSERT INTO Now_Playing (sessionid, artist, album, track, expires, mbid) VALUES ('
. $MQsess . ', '
. $session_id . ', '
. $artist . ', '
. $album . ', '
. $track . ', '
......@@ -80,10 +93,6 @@ try {
die('FAILED ' . $e->getMessage() . "\n");
}
createArtistIfNew($artist);
if ($album != 'NULL') {
createAlbumIfNew($artist, $album);
}
getTrackCreateIfNew($artist, $album, $track, $mbid);
//Expire old tracks
......
......@@ -48,11 +48,9 @@ function useridFromSID($session_id) {
function createArtistIfNew($artist) {
global $adodb;
$artist = NoSpamTracks($artist);
$id = $adodb->GetOne('SELECT id FROM Artist WHERE lower(name) = lower(' . $artist . ')');
$res = $adodb->GetOne('SELECT name FROM Artist WHERE lower(name) = lower(' . $artist . ')');
if (!$res) {
if (!$id) {
// Artist doesn't exist, so we create them
$res = $adodb->Execute('INSERT INTO Artist (name) VALUES (' . $artist . ')');
}
......@@ -61,11 +59,14 @@ function createArtistIfNew($artist) {
function createAlbumIfNew($artist, $album) {
global $adodb;
$name = $adodb->GetOne('SELECT name FROM Album WHERE lower(name) = lower(' . $album . ') AND lower(artist_name) = lower(' . $artist . ')');
$id = $adodb->GetOne('SELECT id FROM Album WHERE lower(name) = lower(' . $album . ') AND lower(artist_name) = lower(' . $artist . ')');
if (!$name) {
if (!$id) {
// Album doesn't exist, so create it
// First check if artist exist, if not create it
createArtistIfNew($artist);
// Disable to fix scrobble breakage
//$art = $adodb->qstr(getAlbumArt($artist, $album));
$art = '';
......@@ -83,9 +84,6 @@ function createAlbumIfNew($artist, $album) {
function getTrackCreateIfNew($artist, $album, $track, $mbid) {
global $adodb;
$track = NoSpamTracks($track);
$artist = NoSpamTracks($artist);
if ($album != 'NULL') {
$res = $adodb->GetOne('SELECT id FROM Track WHERE lower(name) = lower(' . $track . ') AND lower(artist_name) = lower(' . $artist . ') AND lower(album_name) = lower(' . $album . ')');
} else {
......@@ -93,6 +91,13 @@ function getTrackCreateIfNew($artist, $album, $track, $mbid) {
}
if (!$res) {
// First check if artist and album exists, if not create them
if ($album != 'NULL') {
createAlbumIfNew($artist, $album);
} else {
createArtistIfNew($artist);
}
// Create new track
$res = $adodb->Execute('INSERT INTO Track (name, artist_name, album_name, mbid) VALUES ('
. $track . ', '
......@@ -105,7 +110,7 @@ function getTrackCreateIfNew($artist, $album, $track, $mbid) {
}
}
function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid) {
global $adodb;
$res = $adodb->GetOne('SELECT id FROM Scrobble_Track WHERE name = lower('
......@@ -114,6 +119,9 @@ function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
. (($mbid == 'NULL') ? 'IS NULL' : ('= lower(' . $mbid . ')')));
if (!$res) {
// First check if track exists, if not create it
$tid = getTrackCreateIfNew($artist, $album, $track, $mbid);
$sql = 'INSERT INTO Scrobble_Track (name, artist, album, mbid, track) VALUES ('
. 'lower(' . $track . '), '
. 'lower(' . $artist . '), '
......@@ -121,7 +129,7 @@ function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
. (($mbid == 'NULL') ? 'NULL' : 'lower(' . $mbid . ')') . ', '
. $tid . ')';
$res = $adodb->Execute($sql);
return getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid);
return getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid);
} else {
return $res;
}
......@@ -139,7 +147,7 @@ function scrobbleExists($userid, $artist, $track, $time) {
}
}
function NoSpamTracks($track) {
function noSpamTracks($track) {
// This function exists to remove things like '(PREVIEW: buy it at www.magnatune.com)' from track names.
$track = str_replace(' (PREVIEW: buy it at www.magnatune.com)', '', $track);
......@@ -152,7 +160,7 @@ function getAlbumArt($artist, $album) {
$Access_Key_ID = '1EST86JB355JBS3DFE82'; // this is mattl's personal key :)
$SearchIndex = 'Music';
$Keywords = urlencode($artist . ' ' . $album);
$Keywords = rawurlencode($artist . ' ' . $album);
$Operation = 'ItemSearch';
$Version = '2007-07-16';
$ResponseGroup = 'ItemAttributes,Images';
......@@ -193,13 +201,13 @@ function validateMBID($input) {
function forwardScrobble($userid, $artist, $album, $track, $time, $mbid, $source, $rating, $length) {
global $adodb, $lastfm_key, $lastfm_secret;
$artist = urlencode($artist);
$track = urlencode($track);
$album = urlencode($album);
$mbid = urlencode($mbid);
$source = urlencode($source);
$rating = urlencode($rating);
$length = urlencode($length);
$artist = rawurlencode($artist);
$track = rawurlencode($track);
$album = rawurlencode($album);
$mbid = rawurlencode($mbid);
$source = rawurlencode($source);
$rating = rawurlencode($rating);
$length = rawurlencode($length);
$res = $adodb->CacheGetAll(600, 'SELECT * FROM Service_Connections WHERE userid = ' . $userid . ' AND forward = 1');
foreach ($res as &$row) {
......
......@@ -38,7 +38,7 @@ require_once('temp-utils.php');
<?php
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from Scrobbles');
$total = $adodb->CacheGetOne(500, 'SELECT SUM(scrobble_count) as total from User_Stats');
if (!$total) {
die('sql error');
}
......
......@@ -40,43 +40,52 @@ $actualcount = 0;
$timeisstupid = 0;
for ($i = 0; $i < count($_POST['a']); $i++) {
switch (mb_detect_encoding($_POST['a'][$i])) {
case 'ASCII':
case 'UTF-8':
$artist = $adodb->qstr(trim(mb_strcut($_POST['a'][$i], 0, 255, 'UTF-8')));
break;
default:
die("FAILED Bad encoding in artist submission $i\n");
if (!isset($_POST['t'][$i]) || !isset($_POST['a'][$i]) || !isset($_POST['i'][$i])) {
$f = isset($_POST['t'][$i]) ? "T({$_POST['t'][$i]})" : 't';
$f .= isset($_POST['a'][$i]) ? "A({$_POST['a'][$i]})" : 'a';
$f .= isset($_POST['i'][$i]) ? "I({$_POST['i'][$i]})" : 'i';
//Add error message to db and skip to next scrobble
reportError("FAILED Track $i was submitted with empty mandatory field(s)",
"artist:{$_POST['a'][$i]}, album:{$_POST['b'][$i]}, track:{$_POST['t'][$i]}, time:{$_POST['i'][$i]}");
continue;
}
if (isset($_POST['b'][$i]) && !empty($_POST['b'][$i])) {
switch (mb_detect_encoding($_POST['b'][$i])) {
$artist = trim($_POST['a'][$i]);
$artist = noSpamTracks($artist);
if (empty($artist)) {
//Add error message to db and skip to next scrobble
reportError("FAILED Track $i was submitted with empty artist field",
"artist:{$_POST['a'][$i]}, album:{$_POST['b'][$i]}, track:{$_POST['t'][$i]}, time:{$_POST['i'][$i]}");
continue;
} else {
switch (mb_detect_encoding($artist)) {
case 'ASCII':
case 'UTF-8':
$album = $adodb->qstr(trim(mb_strcut($_POST['b'][$i], 0, 255, 'UTF-8')));
$artist = $adodb->qstr(trim(mb_strcut($artist, 0, 255, 'UTF-8')));
break;
default:
die("FAILED Bad encoding in album submission $i\n");
die("FAILED Bad encoding in artist submission $i\n");
}
} else {
$album = 'NULL';
}
if (!isset($_POST['t'][$i]) || !isset($_POST['a'][$i]) || !isset($_POST['i'][$i])) {
$f = isset($_POST['t'][$i]) ? "T({$_POST['t'][$i]})" : 't';
$f .= isset($_POST['a'][$i]) ? "A({$_POST['a'][$i]})" : 'a';
$f .= isset($_POST['i'][$i]) ? "I({$_POST['i'][$i]})" : 'i';
die("FAILED Track $i was submitted with empty mandatory field(s): {$f}\n");
}
switch (mb_detect_encoding($_POST['t'][$i])) {
$track = trim($_POST['t'][$i]);
$track = noSpamTracks($track);
if (empty($track)) {
//Add error message to db and skip to next scrobble
reportError("FAILED Track $i was submitted with empty track field",
"artist:{$_POST['a'][$i]}, album:{$_POST['b'][$i]}, track:{$_POST['t'][$i]}, time:{$_POST['i'][$i]}");
continue;
} else {
switch (mb_detect_encoding($track)) {
case 'ASCII':
case 'UTF-8':
$track = $adodb->qstr(trim(mb_strcut($_POST['t'][$i], 0, 255, 'UTF-8')));
$track = $adodb->qstr(trim(mb_strcut($track, 0, 255, 'UTF-8')));
break;
default:
die("FAILED Bad encoding in title submission $i\n");
}
}
if (is_numeric($_POST['i'][$i])) {
......@@ -87,6 +96,21 @@ for ($i = 0; $i < count($_POST['a']); $i++) {
$time = strtotime($_POST['i'][$i]);
}
$album = trim($_POST['b'][$i]);
$album = noSpamTracks($album);
if (!empty($album)) {
switch (mb_detect_encoding($album)) {
case 'ASCII':
case 'UTF-8':
$album = $adodb->qstr(trim(mb_strcut($album, 0, 255, 'UTF-8')));
break;
default:
die("FAILED Bad encoding in album submission $i\n");
}
} else {
$album = 'NULL';
}
$mb = validateMBID($_POST['m'][$i]);
if ($mb) {
......@@ -123,14 +147,12 @@ for ($i = 0; $i < count($_POST['a']); $i++) {
$failed = false;
try {
createArtistIfNew($artist);
if ($album != 'NULL') {
createAlbumIfNew($artist, $album);
$exists = scrobbleExists($userid, $artist, $track, $time);
if (!$exists) {
$stid = getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid);
}
$tid = getTrackCreateIfNew($artist, $album, $track, $mbid);
$stid = getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid);
$exists = scrobbleExists($userid, $artist, $track, $time);
} catch (Exception $ex) {
$failed = true;
reportError($ex->getMessage(), '');
......
......@@ -9,11 +9,14 @@ RewriteRule ^user/([^/]+)/stats/?$ user-stats.php?user=$1 [NC,QSA]
RewriteRule ^user/([^/]+)/station/?$ user-station.php?user=$1 [NC,QSA]
RewriteRule ^user/([^/]+)/recommended/?$ user-recommended.php?user=$1 [NC,QSA]
RewriteRule ^artist/([^/]+)/track/([^/]+)/edit/?$ track-add.php?artist=$1&track=$2 [NC,QSA]
RewriteRule ^artist/([^/]+)/track/([^/]+)/tag/?$ track-tag.php?artist=$1&track=$2 [NC,QSA]
RewriteRule ^artist/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&track=$2 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/add/?$ track-add.php?artist=$1&album=$2 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/edit/?$ track-add.php?artist=$1&album=$2&track=$3 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/tag/?$ track-tag.php?artist=$1&album=$2&track=$3 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&album=$2&track=$3 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/add/?$ album-add.php?artist=$1 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/([^/]+)/edit/?$ album-add.php?artist=$1&album=$2 [NC,QSA]
RewriteRule ^artist/([^/]+)/album/([^/]+)/?$ album.php?artist=$1&album=$2 [NC,QSA]
RewriteRule ^artist/([^/]+)/?$ artist.php?artist=$1 [NC,QSA]
RewriteRule ^artist/([^/]+)/manage/?$ artist-manage.php?artist=$1 [NC,QSA]
......
......@@ -25,6 +25,7 @@ require_once('../api/UserXML.php');
require_once('../api/JSONEncoder.php');
require_once('../api/TrackXML.php');
require_once('../api/AlbumXML.php');
require_once('../api/TagXML.php');
require_once('../data/Server.php');
require_once('../radio/radio-utils.php');
......@@ -79,18 +80,27 @@ $method_map = array(
'artist.getinfo' => method_artist_getInfo,
'artist.gettoptracks' => method_artist_getTopTracks,
'artist.gettoptags' => method_artist_getTopTags,
'artist.gettags' => method_artist_getTags,
'artist.getflattr' => method_artist_getFlattr,
'album.addtags' => method_album_addTags,
'album.gettoptags' => method_album_getTopTags,
'album.gettags' => method_album_getTags,
'user.getinfo' => method_user_getInfo,
'user.gettoptracks' => method_user_getTopTracks,
'user.getrecenttracks' => method_user_getRecentTracks,
'user.gettoptags' => method_user_getTopTags,
'user.getpersonaltags' => method_user_getPersonalTags,
'user.gettaginfo' => method_user_getTagInfo,
'user.getlovedtracks' => method_user_getLovedTracks,
'user.getbannedtracks' => method_user_getBannedTracks,
'user.getneighbours' => method_user_getNeighbours,
'radio.tune' => method_radio_tune,
'radio.getplaylist' => method_radio_getPlaylist,
'tag.gettoptags' => method_tag_getTopTags,
'tag.gettopartists' => method_tag_getTopArtists,
'tag.gettopalbums' => method_tag_getTopAlbums,
'tag.gettoptracks' => method_tag_getTopTracks,
'tag.getinfo' => method_tag_getInfo,
'track.addtags' => method_track_addTags,
'track.gettoptags' => method_track_getTopTags,
'track.gettags' => method_track_getTags,
......@@ -122,10 +132,39 @@ function method_user_getTopTags() {
report_failure(LFM_INVALID_PARAMS);
}
$xml = UserXML::getTopTags($_GET['user']);
$limit = get_with_default('limit', 50);
$cache = 600;
$xml = UserXML::getTopTags($_GET['user'], $limit, $cache);
respond($xml);
}
function method_user_getPersonalTags() {
if(!isset($_GET['user']) or !isset($_GET['tag']) or !isset($_GET['taggingtype'])) {
report_failure(LFM_INVALID_PARAMS);
}
$limit = get_with_default('limit', 10);
$page = get_with_default('page', 1);
$streamable = False;
$cache = 600;