diff options
Diffstat (limited to 'vdr-vdrmanager/vdrmanager.cpp')
-rw-r--r-- | vdr-vdrmanager/vdrmanager.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/vdr-vdrmanager/vdrmanager.cpp b/vdr-vdrmanager/vdrmanager.cpp index 2b81464..6542c89 100644 --- a/vdr-vdrmanager/vdrmanager.cpp +++ b/vdr-vdrmanager/vdrmanager.cpp @@ -12,10 +12,11 @@ #include <vdr/device.h> #include <vdr/player.h> #include "vdrmanagerthread.h" +#include "compressor.h" #define VDRMANAGER_PORT 6420 -static const char *VERSION = "0.9"; +static const char *VERSION = "0.10"; static const char *DESCRIPTION = "VDR-Manager support plugin"; class cVdrManager: public cPlugin { @@ -25,7 +26,7 @@ private: int port; const char * password; bool forceCheckSvdrp; - bool forceDelete; + int compressionMode; protected: public: cVdrManager(void); @@ -57,7 +58,6 @@ cVdrManager::cVdrManager(void) { port = VDRMANAGER_PORT; password = ""; forceCheckSvdrp = false; - forceDelete = false; } cVdrManager::~cVdrManager() { @@ -73,12 +73,15 @@ cMenuSetupPage * cVdrManager::SetupMenu(void) { } const char * cVdrManager::CommandLineHelp(void) { - return " -p port port number to listen to\n -P password password (none if not given). No password forces check against svdrphosts.conf.\n -s force check against svdrphosts.conf, even if a password was given\n -f force delete of a timer or a recording even if they are active\n"; + return " -p port port number to listen to\n" + " -P password password (none if not given). No password forces check against svdrphosts.conf.\n" + " -s force check against svdrphosts.conf, even if a password was given\n" + " -c compression selects the compression mode to use (zlib or gzip). Default is zlib"; } bool cVdrManager::ProcessArgs(int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "p:P:s:f")) != -1) + while ((c = getopt(argc, argv, "c::p:P:s")) != -1) switch (c) { case 'p': port = atoi(optarg); @@ -89,16 +92,18 @@ bool cVdrManager::ProcessArgs(int argc, char *argv[]) { case 's': forceCheckSvdrp = true; break; - case 'f': - forceDelete = true; + case 'c': + if (!optarg) { + compressionMode = COMPRESSION_ZLIB; + } else if (optarg[0] == 'g') { + compressionMode = COMPRESSION_GZIP; + } else if (optarg[0] == 'z') { + compressionMode = COMPRESSION_ZLIB; + } else { + return false; + } break; case '?': - if (optopt == 'c') { - fprintf(stderr, "Option -%c requires an argument.\n", optopt); - } else if (isprint(optopt)) - fprintf(stderr, "Unknown option `-%c'.\n", optopt); - else - fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); return false; default: return false; @@ -115,7 +120,8 @@ bool cVdrManager::Initialize(void) { // Initialize any background activities the plugin shall perform. // Start any background activities the plugin shall perform. - Thread = new cVdrManagerThread(port, password, forceCheckSvdrp); + Thread = new cVdrManagerThread(port, password, forceCheckSvdrp, + compressionMode); return Thread != NULL; } |