1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
/*
* tvguide.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#include <time.h>
#include <getopt.h>
#include <vdr/osd.h>
#include <vdr/plugin.h>
#include <vdr/device.h>
#include <vdr/menu.h>
#define DEFINE_CONFIG 1
#include "geometrymanager.h"
#include "fontmanager.h"
#include "imagecache.h"
#include "config.h"
#include "setup.h"
#include "tvguideosd.h"
#if defined(APIVERSNUM) && APIVERSNUM < 20000
#error "VDR-2.0.0 API version or greater is required!"
#endif
static const char *VERSION = "1.2.0pre";
static const char *DESCRIPTION = "A fancy 2d EPG Viewer";
static const char *MAINMENUENTRY = "Tvguide";
class cPluginTvguide : public cPlugin {
public:
cPluginTvguide(void);
virtual ~cPluginTvguide();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return DESCRIPTION; }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Initialize(void);
virtual bool Start(void);
virtual void Stop(void);
virtual void Housekeeping(void);
virtual void MainThreadHook(void);
virtual cString Active(void);
virtual time_t WakeupTime(void);
virtual const char *MainMenuEntry(void) { return (tvguideConfig.showMainMenuEntry)?MAINMENUENTRY:NULL; }
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
virtual bool Service(const char *Id, void *Data = NULL);
virtual const char **SVDRPHelpPages(void);
virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode);
};
cPluginTvguide::cPluginTvguide(void) {
}
cPluginTvguide::~cPluginTvguide() {
}
const char *cPluginTvguide::CommandLineHelp(void) {
return
" -e <IMAGESDIR>, --epgimages=<IMAGESDIR> Set directory where epgimages are stored.\n"
" -i <ICONDIR>, --icons=<ICONDIR> Set directory where icons are stored.\n"
" -l <LOGODIR>, --logodir=<LOGODIR> Set directory where logos are stored.\n";
}
bool cPluginTvguide::ProcessArgs(int argc, char *argv[]) {
static const struct option long_options[] = {
{ "epgimages", required_argument, NULL, 'e' },
{ "iconpath", required_argument, NULL, 'i' },
{ "logopath", required_argument, NULL, 'l' },
{ 0, 0, 0, 0 }
};
int c;
while ((c = getopt_long(argc, argv, "e:i:l:", long_options, NULL)) != -1) {
switch (c) {
case 'e':
tvguideConfig.SetImagesPath(cString(optarg));
break;
case 'i':
tvguideConfig.SetIconsPath(cString(optarg));
break;
case 'l':
tvguideConfig.SetLogoPath(cString(optarg));
break;
default:
return false;
}
}
return true;
}
bool cPluginTvguide::Initialize(void) {
tvguideConfig.SetDefaultPathes();
tvguideConfig.LoadTheme();
tvguideConfig.SetStyle();
tvguideConfig.setDynamicValues();
geoManager.SetGeometry(cOsd::OsdWidth(), cOsd::OsdHeight());
fontManager.SetFonts();
imgCache.CreateCache();
return true;
}
bool cPluginTvguide::Start(void) {
return true;
}
void cPluginTvguide::Stop(void) {
}
void cPluginTvguide::Housekeeping(void) {
}
void cPluginTvguide::MainThreadHook(void) {
}
cString cPluginTvguide::Active(void) {
return NULL;
}
time_t cPluginTvguide::WakeupTime(void) {
return 0;
}
cOsdObject *cPluginTvguide::MainMenuAction(void) {
return new cTvGuideOsd;
}
cMenuSetupPage *cPluginTvguide::SetupMenu(void) {
return new cTvguideSetup();
}
bool cPluginTvguide::SetupParse(const char *Name, const char *Value) {
return tvguideConfig.SetupParse(Name, Value);
}
bool cPluginTvguide::Service(const char *Id, void *Data) {
if (strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule") == 0 && tvguideConfig.replaceOriginalSchedule != 0) {
if (Data == NULL)
return true;
cOsdObject **guide = (cOsdObject**) Data;
if (guide)
*guide = MainMenuAction();
return true;
}
return false;
}
const char **cPluginTvguide::SVDRPHelpPages(void) {
return NULL;
}
cString cPluginTvguide::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) {
return NULL;
}
VDRPLUGINCREATOR(cPluginTvguide);
|