This repository has been archived by the owner on May 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.c
62 lines (54 loc) · 1.6 KB
/
config.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
#include "config.h"
using namespace std;
cTVScraperConfig::cTVScraperConfig() {
enableDebug = 0;
}
cTVScraperConfig::~cTVScraperConfig() {
}
void cTVScraperConfig::ClearChannels(void) {
channels.clear();
}
void cTVScraperConfig::AddChannel(string channelID) {
channels.push_back(channelID);
}
bool cTVScraperConfig::ChannelActive(int channelNum) {
#if APIVERSNUM < 20301
cChannel *channel = Channels.GetByNumber(channelNum);
#else
LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByNumber(channelNum);
#endif
if (channel) {
string channelID = "";
channelID = *(channel->GetChannelID().ToString());
int numChannels = channels.size();
for (int i=0; i<numChannels; i++) {
if (!channels[i].compare(channelID)) {
return true;
}
}
}
return false;
}
bool cTVScraperConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "ScrapChannels") == 0) {
splitstring s(Value);
vector<string> flds = s.split(';');
int numChannels = flds.size();
for (int i=0; i<numChannels; i++) {
channels.push_back(flds[i]);
}
return true;
} else if (strcmp(Name, "enableDebug") == 0) {
enableDebug = atoi(Value);
return true;
}
return false;
}
void cTVScraperConfig::PrintChannels(void) {
int numChannels = channels.size();
esyslog("tvscraper: %d channel to be scrapped", numChannels);
for (int i=0; i<numChannels; i++) {
esyslog("tvscraper: channel to be scrapped: %s", channels[i].c_str());
}
}