From f40d511775eb8dfae9a28870c5e0125b5e55b305 Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 24 Sep 2013 14:49:29 +0100 Subject: category list XML/json --- rotord/src/rotord.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'rotord/src/rotord.cpp') diff --git a/rotord/src/rotord.cpp b/rotord/src/rotord.cpp index e7c68cf..a22c6c3 100644 --- a/rotord/src/rotord.cpp +++ b/rotord/src/rotord.cpp @@ -187,6 +187,30 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS } } } + else if (command[0]=="listcategories") { + if (command.size()>1){ + if (command[1]=="json") { + Json::Value root; + Json::StyledWriter writer; + //root["title"]="Lights Down @Rotor"; + //root["audio"]="filename"; + + Node_factory factory; + factory.list_categories(root); + string content = writer.write(root); + status=HTTPResponse::HTTP_OK; + return new RenderContextHandler(content, status); + } + } + else { + XML.pushTag("rotor"); + if (request.getMethod()=="GET") { + Node_factory factory; + factory.list_categories(XML); + status=HTTPResponse::HTTP_OK; + } + } + } else if (command[0]=="listnode") { XML.pushTag("rotor"); if (request.getMethod()=="GET") { -- cgit v1.2.3