summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-04-27 06:25:19 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-04-27 06:25:19 +0000
commitd2b70bbc619f3bfbc0b6593e0558f9ac2aadf6a2 (patch)
tree356feb5f118296378101494c6860195f98a765c3
parentded956d517fac5b46040a0478eb8415b30ef0baa (diff)
downloadampache-d2b70bbc619f3bfbc0b6593e0558f9ac2aadf6a2.tar.gz
ampache-d2b70bbc619f3bfbc0b6593e0558f9ac2aadf6a2.tar.bz2
ampache-d2b70bbc619f3bfbc0b6593e0558f9ac2aadf6a2.zip
added genre and playlist count to the xmlapi handshake per devs request
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/api.class.php13
2 files changed, 11 insertions, 3 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 46cff16a..17543d55 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4
+ - Added Playlist and Genre Counts to the XMLAPI Handshake
- Added ability to Add Search Results to playlist, or download
if batch download is enabled
- Fixed Remove one vote, removes all votes on democratic play
diff --git a/lib/class/api.class.php b/lib/class/api.class.php
index 50ca9609..f64c08fd 100644
--- a/lib/class/api.class.php
+++ b/lib/class/api.class.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -99,17 +99,24 @@ class Api {
$row = Dba::fetch_assoc($db_results);
// Now we need to quickly get the totals of songs
- $sql = "SELECT COUNT(`id`) AS `song`,COUNT(DISTINCT(`album`)) AS `album`,COUNT(DISTINCT(`artist`)) AS `artist` FROM `song`";
+ $sql = "SELECT COUNT(`id`) AS `song`,COUNT(DISTINCT(`album`)) AS `album`," .
+ "COUNT(DISTINCT(`artist`)) AS `artist`,COUNT(DISTINCT(`genre`)) as `genre` FROM `song`";
$db_results = Dba::query($sql);
$counts = Dba::fetch_assoc($db_results);
+ $sql = "SELECT COUNT(`id`) AS `playlist` FROM `playlist`";
+ $db_results = Dba::query($sql):
+ $playlist = Dba::fetch_assoc($db_results);
+
return array('auth'=>$token,
'api'=>self::$version,
'update'=>date("r",$row['update']),
'add'=>date("r",$row['add']),
'songs'=>$counts['song'],
'albums'=>$counts['album'],
- 'artists'=>$counts['artist']);
+ 'artists'=>$counts['artist'],
+ 'genres'=>$counts['genre'],
+ 'playlists'=>$playlist['playlist']);
} // match
} // end while