forked from rofafor/vdr-plugin-iptv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.cpp
73 lines (58 loc) · 2.17 KB
/
config.cpp
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
/*
* config.c: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#include "log.h"
#include "config.h"
cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig()
: traceModeM(eTraceModeNormal),
protocolBasePortM(4321),
useBytesM(1),
sectionFilteringM(1),
threadQueueSize(32),
stillPicture(0),
enableEpgScan(0),
ytdlpPath("/usr/local/bin/yt-dlp") {
for (unsigned int i = 0; i < ARRAY_SIZE(disabledFiltersM); ++i) {
disabledFiltersM[i] = -1;
}
memset(configDirectoryM, 0, sizeof(configDirectoryM));
memset(resourceDirectoryM, 0, sizeof(resourceDirectoryM));
memset(resourceDirectoryM, 0, sizeof(resourceDirectoryM));
memset(m3uCfgPath, 0, sizeof(m3uCfgPath));
memset(ytdlpPath, 0, sizeof(ytdlpPath));
}
unsigned int cIptvConfig::GetDisabledFiltersCount() const {
unsigned int n = 0;
while ((n < ARRAY_SIZE(disabledFiltersM) && (disabledFiltersM[n]!=-1))) {
n++;
}
return n;
}
int cIptvConfig::GetDisabledFilters(unsigned int indexP) const {
return (indexP < ARRAY_SIZE(disabledFiltersM)) ? disabledFiltersM[indexP] : -1;
}
void cIptvConfig::SetDisabledFilters(unsigned int indexP, int numberP) {
if (indexP < ARRAY_SIZE(disabledFiltersM)) {
disabledFiltersM[indexP] = numberP;
}
}
void cIptvConfig::SetConfigDirectory(const char *directoryP) {
debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
}
void cIptvConfig::SetResourceDirectory(const char *directoryP) {
debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, resourceDirectoryM), "Cannot canonicalize resource directory");
}
void cIptvConfig::SetYtdlpPath(const char *path) {
debug1("%s (%s)", __PRETTY_FUNCTION__, path);
ERROR_IF(!realpath(path, ytdlpPath), "Cannot canonicalize ytdlp path");
}
void cIptvConfig::SetM3uCfgPath(const char *directoryP) {
debug1("%s (%s)", __PRETTY_FUNCTION__, directoryP);
ERROR_IF(!realpath(directoryP, m3uCfgPath), "Cannot canonicalize m3ucfg directory");
}