-
Notifications
You must be signed in to change notification settings - Fork 5
/
epgsearch.c
719 lines (622 loc) · 28.4 KB
/
epgsearch.c
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
/* -*- c++ -*-
Copyright (C) 2004-2013 Christian Wieninger
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
The author can be reached at [email protected]
The project's page is at http://winni.vdr-developer.org/epgsearch
*/
/*
* epgsearch.c: A plugin for the Video Disk Recorder
*
*/
#define DISABLE_TEMPLATES_COLLIDING_WITH_STL
#include <vector>
#include <vdr/plugin.h>
#include <vdr/status.h>
#include <vdr/epg.h>
#ifdef __FreeBSD__
#include <netinet/in.h>
#endif
#include <getopt.h>
#include "menu_event.h"
#include "menu_main.h"
#include "menu_whatson.h"
#include "epgsearchsetup.h"
#include "epgsearchcfg.h"
#include "epgsearchext.h"
#include "epgsearchcats.h"
#include "menu_searchresults.h"
#include "searchtimer_thread.h"
#include "switchtimer_thread.h"
#include "menu_myedittimer.h"
#include "epgsearchtools.h"
#include "rcfile.h"
#include "changrp.h"
#include "recstatus.h"
#include "timerstatus.h"
#include "recdone.h"
#include "blacklist.h"
#include "menu_search.h"
#include "templatefile.h"
#include "menu_conflictcheck.h"
#include "epgsearch.h"
#include "conflictcheck_thread.h"
#include "uservars.h"
#include "mail.h"
#include "svdrpclient.h"
#include "noannounce.h"
#include "menu_deftimercheckmethod.h"
#include "timerdone.h"
#include "epgsearchservices.h"
#include "menu_quicksearch.h"
#include "menu_announcelist.h"
#include "confdloader.h"
#include "pending_notifications.h"
#if defined(APIVERSNUM) && APIVERSNUM < 20306
#error "VDR-2.3.6 API version or greater is required!"
#endif
static const char VERSION[] = "2.4.3";
static const char DESCRIPTION[] = trNOOP("search the EPG for repeats and more");
// globals
char *ConfigDir = NULL;
bool reloadMenuConf = false;
int updateForced = 0;
bool isUTF8 = false;
// LogFile declaration and statics
cLogFile LogFile;
char *cLogFile::LogFileName = NULL;
int cLogFile::loglevellimit = 0;
bool cPluginEpgsearch::VDR_readyafterStartup = false;
// external SVDRPCommand
const char *epgsSVDRP::cSVDRPClient::SVDRPSendCmd = "svdrpsend";
cPluginEpgsearch::cPluginEpgsearch(void)
{
showConflicts = false;
showAnnounces = false;
gl_recStatusMonitor = NULL;
gl_timerStatusMonitor = NULL;
}
cPluginEpgsearch::~cPluginEpgsearch()
{
delete gl_recStatusMonitor;
delete gl_timerStatusMonitor;
cSearchTimerThread::Exit();
cSwitchTimerThread::Exit();
cConflictCheckThread::Exit();
if (ConfigDir) free(ConfigDir);
}
const char* cPluginEpgsearch::Version(void)
{
return VERSION;
}
const char* cPluginEpgsearch::Description(void)
{
return tr(DESCRIPTION);
}
const char *cPluginEpgsearch::CommandLineHelp(void)
{
return " -f file, --svdrpsendcmd=file the path to svdrpsend for external\n"
" SVDRP communication (default is internal\n"
" communication)\n"
" -c path, --config=path to specify a specific config dir for epgsearch\n"
" -l file, --logfile=file to specify a specific logfile for epgsearch\n"
" -v n, --verbose=n verbose level for logfile\n"
" -r, --reloadmenuconf reload epgsearchmenu.conf with plugin call\n"
" -m file, --mailcmd=file path to an alternative mail script for mail\n"
" notification\n";
}
const char *cPluginEpgsearch::MainMenuEntry(void)
{
if (EPGSearchConfig.hidemenu)
return NULL;
if (isempty(EPGSearchConfig.mainmenuentry))
return tr("Program guide");
else
return EPGSearchConfig.mainmenuentry;
}
bool cPluginEpgsearch::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
if (argc == 5 && !strcmp(argv[0], "timermenu")) {
// yes, this is an ugly hack!
argv[1] = (char*) new cMenuMyEditTimer((cTimer*) argv[2], (bool) argv[3], (const cEvent*) argv[4]);
return true;
}
if (argc == 8 && !strcmp(argv[0], "searchepg")) {
cSearchExt* SearchExt = new cSearchExt;
strn0cpy(SearchExt->search, argv[2], sizeof(SearchExt->search));
if (atoi(argv[3]) > 0) {
LOCK_CHANNELS_READ;
SearchExt->useChannel = true;
SearchExt->channelMin = Channels->GetByNumber(atoi(argv[3]));
SearchExt->channelMax = Channels->GetByNumber(atoi(argv[3]));
}
SearchExt->mode = atoi(argv[4]);
SearchExt->useTitle = atoi(argv[5]);
SearchExt->useSubtitle = atoi(argv[6]);
SearchExt->useDescription = atoi(argv[7]);
argv[1] = (char*) new cMenuSearchResultsForSearch(SearchExt, cTemplFile::GetTemplateByName("MenuSearchResults"));
return true;
}
static const struct option long_options[] = {
{ "svdrpsendcmd", required_argument, NULL, 'f' },
{ "config", required_argument, NULL, 'c' },
{ "logfile", required_argument, NULL, 'l' },
{ "verbose", required_argument, NULL, 'v' },
{ "mailcmd", required_argument, NULL, 'm' },
{ "reloadmenuconf", no_argument, NULL, 'r' },
{ NULL, no_argument, NULL, 0 }
};
int c = 0, i = 0;
while ((c = getopt_long(argc, argv, "f:c:l:v:m:r", long_options, &i)) != -1) {
switch (c) {
case 'f':
epgsSVDRP::cSVDRPClient::SVDRPSendCmd = optarg;
EPGSearchConfig.useExternalSVDRP = 1;
break;
case 'c':
if (ConfigDir) free(ConfigDir);
ConfigDir = strdup(optarg);
break;
case 'l':
cLogFile::LogFileName = optarg;
break;
case 'v':
cLogFile::loglevellimit = atoi(optarg);
break;
case 'r':
reloadMenuConf = true;
break;
case 'm':
cMailNotifier::MailCmd = optarg;
break;
default:
return false;
}
}
if (EPGSearchConfig.useExternalSVDRP && access(epgsSVDRP::cSVDRPClient::SVDRPSendCmd, F_OK) != 0) {
LogFile.eSysLog("ERROR - can't find svdrpsend script: '%s'", epgsSVDRP::cSVDRPClient::SVDRPSendCmd);
epgsSVDRP::cSVDRPClient::SVDRPSendCmd = NULL;
}
return true;
}
bool cPluginEpgsearch::Service(const char *Id, void *Data)
{
if (strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule") == 0 && EPGSearchConfig.ReplaceOrgSchedule != 0) {
if (Data == NULL)
return true;
cOsdMenu **menu = (cOsdMenu**) Data;
if (menu)
*menu = (cOsdMenu*) MainMenuAction();
return true;
}
if (strcmp(Id, "Epgsearch-search-v1.0") == 0) {
if (Data == NULL)
return true;
cSearchExt* SearchExt = new cSearchExt;
Epgsearch_search_v1_0* searchData = (Epgsearch_search_v1_0*) Data;
searchData->pResultMenu = NULL;
strn0cpy(SearchExt->search, searchData->query, sizeof(SearchExt->search));
if (searchData->channelNr > 0) {
LOCK_CHANNELS_READ;
SearchExt->useChannel = true;
SearchExt->channelMin = Channels->GetByNumber(searchData->channelNr);
SearchExt->channelMax = Channels->GetByNumber(searchData->channelNr);
}
SearchExt->mode = searchData->mode;
SearchExt->useTitle = searchData->useTitle;
SearchExt->useSubtitle = searchData->useSubTitle;
SearchExt->useDescription = searchData->useDescription;
searchData->pResultMenu = new cMenuSearchResultsForSearch(SearchExt, cTemplFile::GetTemplateByName("MenuSearchResults"));
return true;
}
if (strcmp(Id, "Epgsearch-exttimeredit-v1.0") == 0 && !EPGSearchConfig.useVDRTimerEditMenu) {
if (Data == NULL)
return true;
Epgsearch_exttimeredit_v1_0* serviceData = (Epgsearch_exttimeredit_v1_0*) Data;
serviceData->pTimerMenu = new cMenuMyEditTimer(serviceData->timer, serviceData->bNew, serviceData->event);
return true;
}
if (strcmp(Id, "Epgsearch-enablesearchtimers-v1.0") == 0) {
if (Data == NULL)
return true;
else {
Epgsearch_enablesearchtimers_v1_0* serviceData = (Epgsearch_enablesearchtimers_v1_0*) Data;
if (serviceData->enable && cSearchTimerThread::m_Instance == NULL)
cSearchTimerThread::Init(this);
else if (!serviceData->enable && cSearchTimerThread::m_Instance != NULL)
cSearchTimerThread::Exit();
}
return true;
}
if (strcmp(Id, "Epgsearch-updatesearchtimers-v1.0") == 0) {
if (Data == NULL)
return true;
else {
Epgsearch_updatesearchtimers_v1_0* serviceData = (Epgsearch_updatesearchtimers_v1_0*) Data;
if (!EPGSearchConfig.useSearchTimers) // enable search timer thread if necessary
cSearchTimerThread::Init((cPluginEpgsearch*) cPluginManager::GetPlugin("epgsearch"), true);
updateForced = serviceData->showMessage ? 3 : 1;
}
return true;
}
if (strcmp(Id, "Epgsearch-osdmessage-v1.0") == 0) {
if (Data == NULL)
return true;
else {
Epgsearch_osdmessage_v1_0* serviceData = (Epgsearch_osdmessage_v1_0*) Data;
Skins.Message(serviceData->type, serviceData->message, 5);
}
return true;
}
if (strcmp(Id, "Epgsearch-searchmenu-v1.0") == 0) {
if (Data == NULL)
return true;
EpgSearchMenu_v1_0* serviceData = (EpgSearchMenu_v1_0*) Data;
serviceData->Menu = new cMenuEPGSearchExt();
return true;
}
if (strcmp(Id, "Epgsearch-conflictmenu-v1.0") == 0) {
if (Data == NULL)
return true;
EpgSearchMenu_v1_0* serviceData = (EpgSearchMenu_v1_0*) Data;
serviceData->Menu = new cMenuConflictCheck();
return true;
}
if (strcmp(Id, "Epgsearch-lastconflictinfo-v1.0") == 0) {
if (Data == NULL)
return true;
Epgsearch_lastconflictinfo_v1_0* serviceData = (Epgsearch_lastconflictinfo_v1_0*) Data;
serviceData->nextConflict = cConflictCheckThread::m_cacheNextConflict;
serviceData->relevantConflicts = cConflictCheckThread::m_cacheRelevantConflicts;
serviceData->totalConflicts = cConflictCheckThread::m_cacheTotalConflicts;
return true;
}
if (strcmp(Id, "Epgsearch-searchresults-v1.0") == 0) {
if (Data == NULL)
return true;
cSearchExt* SearchExt = new cSearchExt;
Epgsearch_searchresults_v1_0* searchData = (Epgsearch_searchresults_v1_0*) Data;
searchData->pResultList = NULL;
strn0cpy(SearchExt->search, searchData->query, sizeof(SearchExt->search));
if (searchData->channelNr > 0) {
LOCK_CHANNELS_READ;
SearchExt->useChannel = true;
SearchExt->channelMin = Channels->GetByNumber(searchData->channelNr);
SearchExt->channelMax = Channels->GetByNumber(searchData->channelNr);
}
SearchExt->mode = searchData->mode;
SearchExt->useTitle = searchData->useTitle;
SearchExt->useSubtitle = searchData->useSubTitle;
SearchExt->useDescription = searchData->useDescription;
cSearchResults* results = SearchExt->Run();
// transfer to result list
if (results) {
results->SortBy(CompareEventTime);
searchData->pResultList = new cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>;
cSearchResult *result = results->First();
while (result) {
searchData->pResultList->Add(new Epgsearch_searchresults_v1_0::cServiceSearchResult(result->event));
result = results->Next(result);
}
}
delete SearchExt;
return true;
}
if (strcmp(Id, "Epgsearch-switchtimer-v1.0") == 0) {
if (Data == NULL)
return true;
else {
Epgsearch_switchtimer_v1_0* serviceData = (Epgsearch_switchtimer_v1_0*) Data;
if (!serviceData->event)
return false;
switch (serviceData->mode) {
case 0: {// query existence
cSwitchTimer *lTimer = SwitchTimers.InSwitchList(serviceData->event);
if (lTimer) {
serviceData->switchMinsBefore = lTimer->switchMinsBefore;
serviceData->announceOnly = lTimer->mode;
} // if
serviceData->success = lTimer != NULL;
break;
} // 0
case 1: { // add/modify
cSwitchTimer *lTimer = SwitchTimers.InSwitchList(serviceData->event);
if (lTimer) {
lTimer->switchMinsBefore = serviceData->switchMinsBefore;
lTimer->mode = serviceData->announceOnly;
} else {
cMutexLock SwitchTimersLock(&SwitchTimers);
SwitchTimers.Add(new cSwitchTimer(serviceData->event, serviceData->switchMinsBefore, serviceData->announceOnly));
SwitchTimers.Save();
cSwitchTimerThread::Init();
} // if
serviceData->success = true;
break;
} // 1
case 2: {// delete
cSwitchTimer *lTimer = SwitchTimers.InSwitchList(serviceData->event);
serviceData->success = lTimer != NULL;
if (lTimer) {
cMutexLock SwitchTimersLock(&SwitchTimers);
SwitchTimers.Del(lTimer);
SwitchTimers.Save();
} // if
break;
} // 2
default:
serviceData->success = false;
break;
} // switch
} // if
return true;
} // if
if (strcmp(Id, "Epgsearch-quicksearch-v1.0") == 0) {
if (Data == NULL)
return true;
EpgSearchMenu_v1_0* serviceData = (EpgSearchMenu_v1_0*) Data;
serviceData->Menu = new cMenuQuickSearch(new cSearchExt);
return true;
}
if (strcmp(Id, "Epgsearch-services-v1.0") == 0) {
if (Data == NULL)
return true;
Epgsearch_services_v1_0* serviceData = (Epgsearch_services_v1_0*) Data;
#if __cplusplus < 201103L
std::auto_ptr<cEpgsearchServiceHandler> autoHandler(new cEpgsearchServiceHandler);
serviceData->handler = autoHandler;
#else
std::unique_ptr<cEpgsearchServiceHandler> autoHandler(new cEpgsearchServiceHandler);
serviceData->handler = std::move(autoHandler);
#endif
return true;
}
if (strcmp(Id, "Epgsearch-services-v1.1") == 0) {
if (Data == NULL)
return true;
Epgsearch_services_v1_1* serviceData = (Epgsearch_services_v1_1*) Data;
#if __cplusplus < 201103L
std::auto_ptr<cEpgsearchServiceHandler> autoHandler(new cEpgsearchServiceHandler);
serviceData->handler = autoHandler;
#else
std::unique_ptr<cEpgsearchServiceHandler> autoHandler(new cEpgsearchServiceHandler);
serviceData->handler = std::move(autoHandler);
#endif
return true;
}
return false;
}
bool cPluginEpgsearch::Initialize(void)
{
return true;
}
bool cPluginEpgsearch::Start(void)
{
if (!ConfigDir)
ConfigDir = strdup(cPlugin::ConfigDirectory("epgsearch"));
cPlugconfdirVar::dir = cPlugin::ConfigDirectory();
if (cLogFile::LogFileName)
LogFile.Open(cLogFile::LogFileName, Version());
else
LogFile.Open(AddDirectory(CONFIGDIR, "epgsearch.log"), Version());
gl_recStatusMonitor = new cRecStatusMonitor;
gl_timerStatusMonitor = new cTimerStatusMonitor;
SearchExtCats.Load(AddDirectory(CONFIGDIR, "epgsearchcats.conf"), true);
LoadMenuTemplates();
LoadConfD();
LoadUserVars();
ChannelGroups.Load(AddDirectory(CONFIGDIR, "epgsearchchangrps.conf"), true);
Blacklists.Load(AddDirectory(CONFIGDIR, "epgsearchblacklists.conf"));
SearchExts.Load(AddDirectory(CONFIGDIR, "epgsearch.conf"));
SearchTemplates.Load(AddDirectory(CONFIGDIR, "epgsearchtemplates.conf"));
RecsDone.Load(AddDirectory(CONFIGDIR, "epgsearchdone.data"));
SwitchTimers.Load(AddDirectory(CONFIGDIR, "epgsearchswitchtimers.conf"));
NoAnnounces.Load(AddDirectory(CONFIGDIR, "noannounce.conf"));
DefTimerCheckModes.Load(AddDirectory(CONFIGDIR, "deftimerchkmodes.conf"));
TimersDone.Load(AddDirectory(CONFIGDIR, "timersdone.conf"));
PendingNotifications.Load(AddDirectory(CONFIGDIR, "pendingnotifications.conf"));
cSearchTimerThread::Init(this);
cSwitchTimerThread::Init();
cConflictCheckThread::Init(this);
CheckUTF8();
return true;
}
void cPluginEpgsearch::CheckUTF8()
{
std::string CodeSet = GetCodeset();
isUTF8 = EqualsNoCase(CodeSet, "UTF-8");
}
void cPluginEpgsearch::Stop(void)
{
cSearchTimerThread::Exit();
cSwitchTimerThread::Exit();
}
void cPluginEpgsearch::MainThreadHook(void)
{
if (!VDR_readyafterStartup) {
// signal VDR is ready, otherwise the search timer thread could use SVDRP before it works
LogFile.Log(2, "VDR ready");
VDR_readyafterStartup = true;
}
}
cOsdObject *cPluginEpgsearch::DoInitialSearch(char* rcFilename)
{
cRCFile rcFile;
if (rcFile.Load(rcFilename)) {
cSearchExt* SearchExt = new cSearchExt;
strn0cpy(SearchExt->search, rcFile.Search, sizeof(SearchExt->search));
if (rcFile.ChannelNr != -1) {
LOCK_CHANNELS_READ;
SearchExt->useChannel = true;
SearchExt->channelMin = Channels->GetByNumber(rcFile.ChannelNr);
SearchExt->channelMax = Channels->GetByNumber(rcFile.ChannelNr);
}
SearchExt->mode = rcFile.SearchMode;
SearchExt->useTitle = rcFile.UseTitle;
SearchExt->useSubtitle = rcFile.UseSubtitle;
SearchExt->useDescription = rcFile.UseDescr;
remove(rcFilename);
return new cMenuSearchResultsForSearch(SearchExt, cTemplFile::GetTemplateByName("MenuSearchResults"));
} else
LogFile.eSysLog("could not load '%s'", rcFilename);
return NULL;
}
cOsdObject *cPluginEpgsearch::MainMenuAction(void)
{
if (reloadMenuConf)
LoadMenuTemplates();
if (showConflicts) {
showConflicts = false;
return new cMenuConflictCheck();
}
if (showAnnounces) {
showAnnounces = false;
return new cMenuAnnounceList(cSearchTimerThread::announceList);
}
// Perform the action when selected from the main VDR menu.
cOsdObject* pMenu = NULL;
char* rcFilename = strdup(AddDirectory(CONFIGDIR, ".epgsearchrc"));
if (access(rcFilename, F_OK) == 0)
pMenu = DoInitialSearch(rcFilename);
else
pMenu = new cMenuSearchMain();
free(rcFilename);
return pMenu;
}
void cPluginEpgsearch::LoadMenuTemplates()
{
char* templateFilename = strdup(AddDirectory(CONFIGDIR, "epgsearchmenu.conf"));
if (access(templateFilename, F_OK) == 0) {
cTemplFile templFile;
if (!templFile.Load(templateFilename)) {
templFile.Reset();
LogFile.eSysLog("could not load '%s'", templateFilename);
}
}
cTemplFile::PrepareDefaultTemplates();
free(templateFilename);
}
void cPluginEpgsearch::LoadUserVars()
{
char* userVarFilename = strdup(AddDirectory(CONFIGDIR, "epgsearchuservars.conf"));
if (access(userVarFilename, F_OK) == 0) {
LogFile.Log(1, "loading %s", userVarFilename);
cUserVarFile userVarFile;
if (!userVarFile.Load(userVarFilename))
LogFile.eSysLog("could not load '%s'", userVarFilename);
else
LogFile.Log(2, "loaded uservars from %s", userVarFilename);
}
free(userVarFilename);
UserVars.InitInternalVars();
UserVars.InitExtEPGVars();
}
void cPluginEpgsearch::LoadConfD()
{
cConfDLoader D;
D.Load();
}
cMenuSetupPage *cPluginEpgsearch::SetupMenu(void)
{
// Return a setup menu in case the plugin supports one.
return new cMenuEPGSearchSetup;
}
bool cPluginEpgsearch::SetupParse(const char *Name, const char *Value)
{
if (!strcasecmp(Name, "IsOrgSchedule")) return (EPGSearchConfig.ReplaceOrgSchedule == false);
if (!strcasecmp(Name, "HideMenu")) EPGSearchConfig.hidemenu = atoi(Value);
if (!strcasecmp(Name, "MainMenuEntry")) strcpy(EPGSearchConfig.mainmenuentry, Value);
if (!strcasecmp(Name, "ReplaceOrgSchedule")) EPGSearchConfig.ReplaceOrgSchedule = atoi(Value);
if (!strcasecmp(Name, "StartMenu")) EPGSearchConfig.StartMenu = atoi(Value);
if (!strcasecmp(Name, "RedKeyMode")) EPGSearchConfig.redkeymode = atoi(Value);
if (!strcasecmp(Name, "BlueKeyMode")) EPGSearchConfig.bluekeymode = atoi(Value);
if (!strcasecmp(Name, "ShowProgress")) EPGSearchConfig.showProgress = atoi(Value);
if (!strcasecmp(Name, "ShowChannelNr")) EPGSearchConfig.showChannelNr = atoi(Value);
if (!strcasecmp(Name, "UseOkForSwitch")) EPGSearchConfig.useOkForSwitch = atoi(Value);
if (!strcasecmp(Name, "MaxChannelMenuNow")) EPGSearchConfig.maxChannelMenuNow = atoi(Value);
if (!strcasecmp(Name, "ShowRadioChannels")) EPGSearchConfig.showRadioChannels = atoi(Value);
if (!strcasecmp(Name, "OnePressTimerCreation")) EPGSearchConfig.onePressTimerCreation = atoi(Value);
if (!strcasecmp(Name, "ShowFavoritesMenu")) EPGSearchConfig.showFavoritesMenu = atoi(Value);
if (!strcasecmp(Name, "FavoritesMenuTimespan")) EPGSearchConfig.FavoritesMenuTimespan = atoi(Value);
if (!strcasecmp(Name, "UserMode1Description")) EPGSearchConfig.ShowModes[showUserMode1].SetDescription(Value);
if (!strcasecmp(Name, "UserMode1Time")) EPGSearchConfig.ShowModes[showUserMode1].SetTime(atoi(Value));
if (!strcasecmp(Name, "UserMode1UseIt")) EPGSearchConfig.ShowModes[showUserMode1].SetUsage(atoi(Value));
if (!strcasecmp(Name, "UserMode2Description")) EPGSearchConfig.ShowModes[showUserMode2].SetDescription(Value);
if (!strcasecmp(Name, "UserMode2Time")) EPGSearchConfig.ShowModes[showUserMode2].SetTime(atoi(Value));
if (!strcasecmp(Name, "UserMode2UseIt")) EPGSearchConfig.ShowModes[showUserMode2].SetUsage(atoi(Value));
if (!strcasecmp(Name, "UserMode3Description")) EPGSearchConfig.ShowModes[showUserMode3].SetDescription(Value);
if (!strcasecmp(Name, "UserMode3Time")) EPGSearchConfig.ShowModes[showUserMode3].SetTime(atoi(Value));
if (!strcasecmp(Name, "UserMode3UseIt")) EPGSearchConfig.ShowModes[showUserMode3].SetUsage(atoi(Value));
if (!strcasecmp(Name, "UserMode4Description")) EPGSearchConfig.ShowModes[showUserMode4].SetDescription(Value);
if (!strcasecmp(Name, "UserMode4Time")) EPGSearchConfig.ShowModes[showUserMode4].SetTime(atoi(Value));
if (!strcasecmp(Name, "UserMode4UseIt")) EPGSearchConfig.ShowModes[showUserMode4].SetUsage(atoi(Value));
if (!strcasecmp(Name, "UseSearchTimers")) EPGSearchConfig.useSearchTimers = atoi(Value);
if (!strcasecmp(Name, "UpdateIntervall")) EPGSearchConfig.UpdateIntervall = atoi(Value);
if (!strcasecmp(Name, "SVDRPPort")) EPGSearchConfig.SVDRPPort = atoi(Value);
if (!strcasecmp(Name, "DelayThreads")) EPGSearchConfig.delayThreads = atoi(Value);
if (!strcasecmp(Name, "CheckTimerConflicts")) EPGSearchConfig.checkTimerConflictsAfterUpdate = atoi(Value);
if (!strcasecmp(Name, "CheckTimerConflictsPriority")) EPGSearchConfig.checkMinPriority = atoi(Value);
if (!strcasecmp(Name, "CheckTimerConflictsDays")) EPGSearchConfig.checkMaxDays = atoi(Value);
if (!strcasecmp(Name, "RemoteConflictCheck")) EPGSearchConfig.RemoteConflictCheck = atoi(Value);
if (!strcasecmp(Name, "CheckConflictsIntervall")) EPGSearchConfig.conflictCheckIntervall = atoi(Value);
if (!strcasecmp(Name, "CheckConflictsWithinLimit")) EPGSearchConfig.conflictCheckWithinLimit = atoi(Value);
if (!strcasecmp(Name, "CheckConflictsIntervall2")) EPGSearchConfig.conflictCheckIntervall2 = atoi(Value);
if (!strcasecmp(Name, "CheckConflictsMinDuration")) EPGSearchConfig.checkMinDuration = atoi(Value);
if (!strcasecmp(Name, "CheckConflictsAfterTimerProg")) EPGSearchConfig.checkTimerConflAfterTimerProg = atoi(Value);
if (!strcasecmp(Name, "CheckConflictsOnRecording")) EPGSearchConfig.checkTimerConflOnRecording = atoi(Value);
if (!strcasecmp(Name, "ConflCheckCmd")) strcpy(EPGSearchConfig.conflCheckCmd, Value);
if (!strcasecmp(Name, "NoConflMsgWhileReplay")) EPGSearchConfig.noConflMsgWhileReplay = atoi(Value);
if (!strcasecmp(Name, "NoAnnounceWhileReplay")) EPGSearchConfig.noAnnounceWhileReplay = atoi(Value);
if (!strcasecmp(Name, "TimerProgRepeat")) EPGSearchConfig.TimerProgRepeat = atoi(Value);
if (!strcasecmp(Name, "CheckEPGHours")) EPGSearchConfig.checkEPGHours = atoi(Value);
if (!strcasecmp(Name, "CheckEPGWarnByOSD")) EPGSearchConfig.checkEPGWarnByOSD = atoi(Value);
if (!strcasecmp(Name, "CheckEPGWarnByMail")) EPGSearchConfig.checkEPGWarnByMail = atoi(Value);
if (!strcasecmp(Name, "CheckEPGChannelgroup")) EPGSearchConfig.checkEPGchannelGroupNr = atoi(Value);
if (!strcasecmp(Name, "TimeIntervallFRFF")) EPGSearchConfig.timeShiftValue = atoi(Value);
if (!strcasecmp(Name, "ToggleGreenYellow")) EPGSearchConfig.toggleGreenYellow = atoi(Value);
if (!strcasecmp(Name, "DefPriority")) EPGSearchConfig.DefPriority = atoi(Value);
if (!strcasecmp(Name, "DefLifetime")) EPGSearchConfig.DefLifetime = atoi(Value);
if (!strcasecmp(Name, "DefMarginStart")) EPGSearchConfig.DefMarginStart = atoi(Value);
if (!strcasecmp(Name, "DefMarginStop")) EPGSearchConfig.DefMarginStop = atoi(Value);
#if defined(APIVERSNUM) && APIVERSNUM > 20503
if (!strcasecmp(Name, "AllowedErrors")) EPGSearchConfig.AllowedErrors = atoi(Value);
#endif
if (!strcasecmp(Name, "IgnorePayTV")) EPGSearchConfig.ignorePayTV = atoi(Value);
if (!strcasecmp(Name, "DefRecordingDir")) strcpy(EPGSearchConfig.defrecdir, Value);
if (!strcasecmp(Name, "UseVDRTimerEditMenu")) EPGSearchConfig.useVDRTimerEditMenu = atoi(Value);
if (!strcasecmp(Name, "ShowChannelGroups")) EPGSearchConfig.showChannelGroups = atoi(Value);
if (!strcasecmp(Name, "ShowDaySeparators")) EPGSearchConfig.showDaySeparators = atoi(Value);
if (!strcasecmp(Name, "ShowEmptyChannels")) EPGSearchConfig.showEmptyChannels = atoi(Value);
if (!strcasecmp(Name, "DefSearchTemplateID")) EPGSearchConfig.DefSearchTemplateID = atoi(Value);
if (!strcasecmp(Name, "AddSubtitleToTimerMode")) EPGSearchConfig.addSubtitleToTimer = (addSubtitleToTimerMode) atoi(Value);
if (!strcasecmp(Name, "MailViaScript")) EPGSearchConfig.mailViaScript = atoi(Value);
if (!strcasecmp(Name, "MailNotificationSearchtimers")) EPGSearchConfig.sendMailOnSearchtimers = atoi(Value);
if (!strcasecmp(Name, "MailNotificationSearchtimersHours")) EPGSearchConfig.sendMailOnSearchtimerHours = atoi(Value);
if (!strcasecmp(Name, "MailNotificationSearchtimersLastAt")) EPGSearchConfig.lastMailOnSearchtimerAt = atol(Value);
if (!strcasecmp(Name, "MailNotificationConflicts")) EPGSearchConfig.sendMailOnConflicts = atoi(Value);
if (!strcasecmp(Name, "MailAddress")) strcpy(EPGSearchConfig.MailAddress, Value);
if (!strcasecmp(Name, "MailAddressTo")) strcpy(EPGSearchConfig.MailAddressTo, Value);
if (isempty(EPGSearchConfig.MailAddressTo))
strcpy(EPGSearchConfig.MailAddressTo, EPGSearchConfig.MailAddress);
if (!strcasecmp(Name, "MailServer")) strcpy(EPGSearchConfig.MailServer, Value);
if (!strcasecmp(Name, "MailUseAuth")) EPGSearchConfig.MailUseAuth = atoi(Value);
if (!strcasecmp(Name, "MailAuthUser")) strcpy(EPGSearchConfig.MailAuthUser, Value);
if (!strcasecmp(Name, "MailAuthPass")) strcpy(EPGSearchConfig.MailAuthPass, Value);
if (!strcasecmp(Name, "LastMailConflicts")) strcpy(EPGSearchConfig.LastMailConflicts, Value);
return true;
}
cString cPluginEpgsearch::Active(void)
{
return cSearchTimerThread::justRunning ? tr("search timer update running") : NULL;
}
VDRPLUGINCREATOR(cPluginEpgsearch); // Don't touch this!