From f2f017d2b882f37f5d43651a57fc795bd0e2e6e8 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Tue, 31 Mar 2009 20:53:39 +0000 Subject: add video counts to api handshake --- lib/class/api.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/class/api.class.php') diff --git a/lib/class/api.class.php b/lib/class/api.class.php index 397d5f19..2ba94a95 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -164,17 +164,22 @@ class Api { // We need to also get the 'last update' of the catalog information in an RFC 2822 Format $sql = "SELECT MAX(`last_update`) AS `update`,MAX(`last_add`) AS `add`, MAX(`last_clean`) AS `clean` FROM `catalog`"; - $db_results = Dba::query($sql); + $db_results = Dba::read($sql); $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`"; - $db_results = Dba::query($sql); + $db_results = Dba::read($sql); $counts = Dba::fetch_assoc($db_results); + // Next the video counts + $sql = "SELECT COUNT(`id`) AS `video` FROM `video`"; + $db_results = Dba::read($sql); + $vcounts = Dba::fetch_assoc($db_results); + $sql = "SELECT COUNT(`id`) AS `playlist` FROM `playlist`"; - $db_results = Dba::query($sql); + $db_results = Dba::read($sql); $playlist = Dba::fetch_assoc($db_results); return array('auth'=>$token, @@ -185,7 +190,8 @@ class Api { 'songs'=>$counts['song'], 'albums'=>$counts['album'], 'artists'=>$counts['artist'], - 'playlists'=>$playlist['playlist']); + 'playlists'=>$playlist['playlist'], + 'videos'=>$vcounts['video']); } // match } // end while -- cgit