yhook: introduce new format for plain output; key=value

Origin commit data
------------------
Branch: ni/coolstream
Commit: 4c679613d6
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-02-20 (Sat, 20 Feb 2016)

Origin message was:
------------------
- yhook: introduce new format for plain output; key=value

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-02-20 12:06:58 +01:00
parent 9d14197e2b
commit 75139c0af9
3 changed files with 19 additions and 10 deletions

View File

@@ -1058,7 +1058,7 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel *
*/
//-------------------------------------------------------------------------
void CControlAPI::GetBouquetCGI(CyhookHandler *hh) {
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
std::string result = "";
if (!(hh->ParamList.empty())) {
@@ -1211,7 +1211,7 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) {
bool encode = false;
std::string result = "";
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
if (hh->ParamList["showhidden"] == "false")
show_hidden = false;
@@ -1357,7 +1357,7 @@ void CControlAPI::epgDetailList(CyhookHandler *hh) {
}
// ------ generate output ------
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
std::string result = "";
NeutrinoAPI->eList.clear();
@@ -1457,7 +1457,7 @@ void CControlAPI::SendFoundEvents(CyhookHandler *hh, bool xml_format)
if (xml_format) // to stay backward compatible :/
hh->ParamList["format"] = "xml";
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
/* TODO: maybe add following options as in tuxbox neutrino
hh->ParamList["epgitem"]
@@ -2996,7 +2996,7 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh) {
std::string result = "";
std::string configFileName = hh->ParamList["config"];
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
if (hh->ParamList["action"] == "submit")
load = false;
@@ -3133,7 +3133,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
if (hh->ParamList["action"] == "list") { // directory list: action=list&path=<path>
DIR *dirp;
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
std::string path = hh->ParamList["path"];
if ((dirp = opendir(path.c_str()))) {
@@ -3259,7 +3259,7 @@ void CControlAPI::getDirCGI(CyhookHandler *hh) {
std::string item = "";
bool isFirstLine = true;
TOutType outType = hh->outStart();
TOutType outType = hh->outStart(true /*old mode*/);
//Shows all 7 directories stored in the moviebrowser.conf
if (hh->ParamList["dir"] == "moviedir" || hh->ParamList["dir"] == "allmoviedirs" ) {

View File

@@ -28,6 +28,7 @@ CyhookHandler::CyhookHandler()
Method = M_UNKNOWN;
httpStatus = HTTP_NIL;
outType = plain;
outSingle = false;
LastModified=0;
}
@@ -405,7 +406,8 @@ TOutType CyhookHandler::checkOutput() {
return outType;
}
//-----------------------------------------------------------------------------
TOutType CyhookHandler::outStart() {
TOutType CyhookHandler::outStart(bool single) {
outSingle = single; // for compatibility
// get outType
outType = plain; // plain
if (ParamList["format"] == "json")
@@ -440,7 +442,13 @@ std::string CyhookHandler::outPair(std::string _key, std::string _content, bool
result += "\n";
break;
default:
if (outSingle)
result = _content;
else
{
result = _key + "=" + _content;
result += "\n";
}
break;
}
return result;

View File

@@ -139,6 +139,7 @@ public:
std::string Sendfile; // Path & Name (local os style) of file to send
bool keep_alive;
bool cached; // cached by mod_cache
bool outSingle;
// Input
CStringList ParamList; // local copy of ParamList (Request)
@@ -199,7 +200,7 @@ public:
int _outIndent;
TOutType outType; // Outputtpe = plain (default)|xml|json
TOutType outStart();
TOutType outStart(bool single = false);
TOutType checkOutput();
std::string outIndent();
std::string outPair(std::string _key, std::string _content, bool _next);