From 869aa94de4b8711b0a79dd57ccab78f31c4d9378 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Wed, 23 Nov 2005 04:11:04 +0000 Subject: [PATCH] Finish stats xml-rpc method --- src/xml-rpc.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/xml-rpc.c b/src/xml-rpc.c index 603fc28e..932eb467 100644 --- a/src/xml-rpc.c +++ b/src/xml-rpc.c @@ -11,9 +11,11 @@ #include #include "configfile.h" +#include "db-generic.h" #include "daapd.h" #include "err.h" #include "mp3-scanner.h" +#include "rend.h" #include "webserver.h" /* typedefs */ @@ -192,6 +194,33 @@ void xml_get_stats(WS_CONNINFO *pwsc) { xml_push(pxml,"status"); xml_push(pxml,"service_status"); + + xml_push(pxml,"service"); + + xml_output(pxml,"name","Rendezvous"); + +#ifndef WITHOUT_MDNS + if(config.use_mdns) { + xml_output(pxml,"status",rend_running() ? "Stopped" : "Running"); /* ??? */ + } else { + xml_output(pxml,"status","Disabled"); + } +#else + + ws_writefd(pwsc,"No Support \n"); +#endif + xml_pop(pxml); /* service */ + + xml_push(pxml,"service"); + xml_output(pxml,"name","DAAP Server"); + xml_output(pxml,"status",config.stop ? "Stopping" : "Running"); + xml_pop(pxml); /* service */ + + xml_push(pxml,"service"); + xml_output(pxml,"name","File Scanner"); + xml_output(pxml,"status",config.reload ? "Running" : "Idle"); + xml_pop(pxml); /* service */ + xml_pop(pxml); /* service_status */ xml_push(pxml,"thread_status"); @@ -244,6 +273,17 @@ void xml_get_stats(WS_CONNINFO *pwsc) { xml_output(pxml,"name","Uptime"); xml_output(pxml,"value","%s",buf); xml_pop(pxml); /* stat */ + + xml_push(pxml,"stat"); + xml_output(pxml,"name","Songs"); + xml_output(pxml,"value","%d",db_get_song_count()); + xml_pop(pxml); /* stat */ + + xml_push(pxml,"stat"); + xml_output(pxml,"name","Songs Served"); + xml_output(pxml,"value","%d",config.stats.songs_served); + xml_pop(pxml); /* stat */ + xml_pop(pxml); /* statistics */ xml_pop(pxml); /* status */