diff options
author | T. Lohmar <smarttv640@gmail.com> | 2016-01-30 18:00:31 +0100 |
---|---|---|
committer | T. Lohmar <smarttv640@gmail.com> | 2016-01-30 18:00:31 +0100 |
commit | d05f6c86e38b97fbf685361809fa6d733cfdf699 (patch) | |
tree | a49dc9d4cea3a69973dc8dc4b5f95e4d83d8f5cd | |
parent | 9cfa9b686a401c3b65e088dfcd8428aac5fea4ff (diff) | |
download | vdr-plugin-smarttvweb-d05f6c86e38b97fbf685361809fa6d733cfdf699.tar.gz vdr-plugin-smarttvweb-d05f6c86e38b97fbf685361809fa6d733cfdf699.tar.bz2 |
add support for first svdrp command.
-rw-r--r-- | smarttvweb.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/smarttvweb.c b/smarttvweb.c index b85dddc..60827e4 100644 --- a/smarttvweb.c +++ b/smarttvweb.c @@ -60,6 +60,10 @@ public: virtual bool Initialize(void); virtual bool Start(void); virtual bool SetupParse(const char *Name, const char *Value); + + virtual const char **SVDRPHelpPages(void); + virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); + #if VDRVERSNUM > 10300 virtual cString Active(void); #endif @@ -125,6 +129,35 @@ bool cPluginSmartTvWeb::SetupParse(const char *Name, const char *Value) return false; } +const char **cPluginSmartTvWeb::SVDRPHelpPages(void) { + static const char *HelpPages[] = { + "SESSIONS\n" + " Print the number of active sessions.", + NULL + }; + return HelpPages; +} + +cString cPluginSmartTvWeb::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) { + if (strcasecmp(Command, "SESSIONS") == 0) { + return cString::sprintf("%d Active HTTP Sessions", mServer.getActiveHttpSessions()); + } + else if (strcasecmp(Command, "TIME") == 0) { + ReplyCode = 901; + if (*Option) { + if (strcasecmp(Option, "RAW") == 0) + return cString::sprintf("%ld\nThis is the number of seconds since the epoch\nand a demo of a multi-line reply", time(NULL)); + else { + ReplyCode = 504; + return cString::sprintf("Unknown option: \"%s\"", Option); + } + } + return TimeString(time(NULL)); + } + return NULL; +} + + #if VDRVERSNUM > 10300 cString cPluginSmartTvWeb::Active(void) { |