]> git.vomp.tv Git - vompserver.git/blob - vompserver.c
Version number update
[vompserver.git] / vompserver.c
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include <vdr/plugin.h>
22 #include <getopt.h>
23
24 #include "mvpserver.h"
25
26 static const char *VERSION        = "0.2.4";
27 static const char *DESCRIPTION    = "VDR on MVP plugin by Chris Tallon";
28
29 class cPluginVompserver : public cPlugin
30 {
31 public:
32   cPluginVompserver(void);
33   virtual ~cPluginVompserver();
34   virtual const char *Version(void) { return VERSION; }
35   virtual const char *Description(void) { return DESCRIPTION; }
36   virtual const char *CommandLineHelp(void);
37   virtual bool ProcessArgs(int argc, char *argv[]);
38   virtual bool Initialize(void);
39   virtual bool Start(void);
40   virtual bool SetupParse(const char *Name, const char *Value);
41
42 private:
43
44   MVPServer mvpserver;
45   char* configDir;
46 };
47
48 cPluginVompserver::cPluginVompserver(void)
49 {
50   // Initialize any member variables here.
51   // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
52   // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
53
54   configDir = NULL;
55 }
56
57 bool cPluginVompserver::Start(void)
58 {
59   // Start any background activities the plugin shall perform.
60   int success = mvpserver.run(configDir);
61   if (success) return true;
62   else return false;
63 }
64
65 cPluginVompserver::~cPluginVompserver()
66 {
67   // Clean up after yourself!
68   mvpserver.stop();
69 }
70
71 const char *cPluginVompserver::CommandLineHelp(void)
72 {
73   // Return a string that describes all known command line options.
74
75   return "  -c dir    config path relative to VDR plugins config path\n";
76 }
77
78 bool cPluginVompserver::ProcessArgs(int argc, char *argv[])
79 {
80   // Implement command line argument processing here if applicable.
81
82   int c;
83   while ((c = getopt(argc, argv, "c:")) != -1)
84   {
85     if (c == 'c')
86     {
87       configDir = optarg;
88     }
89     else
90     {
91       return false;
92     }
93   }
94
95   return true;
96 }
97
98 bool cPluginVompserver::Initialize(void)
99 {
100   // Initialize any background activities the plugin shall perform.
101   return true;
102 }
103
104 bool cPluginVompserver::SetupParse(const char *Name, const char *Value)
105 {
106   // Parse your own setup parameters and store their values.
107   return false;
108 }
109
110 VDRPLUGINCREATOR(cPluginVompserver); // Don't touch this!
111