diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-07-10 20:21:09 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-07-10 20:21:09 +0000 |
commit | bdddcc8892aacf3baeafb0b2f25db43f86df7655 (patch) | |
tree | a3622df3b6ed9870b6fa5d41c2fa22f598548f41 /lib/xmlrpc.php | |
parent | a025743d762bb5dfe1edcf4131d3e8764fe45283 (diff) | |
download | ampache-bdddcc8892aacf3baeafb0b2f25db43f86df7655.tar.gz ampache-bdddcc8892aacf3baeafb0b2f25db43f86df7655.tar.bz2 ampache-bdddcc8892aacf3baeafb0b2f25db43f86df7655.zip |
new staggered xmlrpc mojo
Diffstat (limited to 'lib/xmlrpc.php')
-rw-r--r-- | lib/xmlrpc.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/xmlrpc.php b/lib/xmlrpc.php index a9d71bc7..194a9808 100644 --- a/lib/xmlrpc.php +++ b/lib/xmlrpc.php @@ -30,18 +30,20 @@ */ /** - * remote_server_query + * remote_catalog_query * this is the initial contact and response to a xmlrpc request from another ampache server * this returns a list of catalog names * @package XMLRPC * @catagory Server */ -function remote_server_query($m) { +function remote_catalog_query($m) { $result = array(); // we only want to send the local entries - $sql = "SELECT name,COUNT(song.id) FROM catalog LEFT JOIN song ON catalog.id = song.catalog WHERE catalog_type='local' GROUP BY catalog.id"; + $sql = "SELECT name,COUNT(song.id) FROM catalog " . + "LEFT JOIN song ON catalog.id = song.catalog " . + "WHERE catalog_type='local' GROUP BY catalog.id"; $db_result = mysql_query($sql, dbh()); while ( $i = mysql_fetch_row($db_result) ) { @@ -65,9 +67,13 @@ function remote_server_query($m) { * @catagory Server * @todo Add catalog level access control * @todo fix for the smallint(1) change of song.status + * @todo serialize the information rather than cheat with the :: */ -function remote_song_query() { +function remote_song_query($params) { + $start = $params->params['0']->me['int']; + $step = $params->params['1']->me['int']; + // Get me a list of all local catalogs $sql = "SELECT catalog.id FROM catalog WHERE catalog_type='local'"; $db_results = mysql_query($sql, dbh()); @@ -75,7 +81,7 @@ function remote_song_query() { $results = array(); $sql = "SELECT song.id FROM song WHERE song.status='enabled' AND ("; - + // Get the catalogs and build the query! while ($r = mysql_fetch_object($db_results)) { $sql .= " song.catalog='$r->id' OR"; @@ -83,8 +89,8 @@ function remote_song_query() { $sql = rtrim($sql,"OR"); - $sql .= ")"; - + $sql .= ") LIMIT $start,$step"; + $db_results = mysql_query($sql, dbh()); // Recurse through the songs and build a results |