Repository navigation
Expand file tree
/
Copy pathconfig.js
More file actions
111 lines (103 loc) · 3.96 KB
/
Copy pathconfig.js
File metadata and controls
111 lines (103 loc) · 3.96 KB
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
const fs = require('fs');
const path = require('path');
const baseConfig = {
port: process.env.PORT || 10000,
defaultUserAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
cacheSettings: {
updateInterval: 2 * 60 * 60 * 1000,
maxAge: 12 * 60 * 60 * 1000,
retryAttempts: 3,
retryDelay: 5000
},
epgSettings: {
maxProgramsPerChannel: 50,
updateInterval: 2 * 60 * 60 * 1000,
cacheExpiry: 12 * 60 * 60 * 1000
},
manifest: {
id: 'org.mccoy88f.omgtv',
version: '1.0.0',
name: 'OMG TV',
description: 'Modalita provvisoria, installazione con errori, attivo mod. provvisoria',
logo: 'https://github.com/mccoy88f/OMG-TV-Stremio-Addon/blob/main/tv.png?raw=true',
resources: ['stream', 'catalog', 'meta'],
types: ['tv'],
idPrefixes: ['tv'],
catalogs: [
{
type: 'tv',
id: 'omg_tv',
name: 'OMG TV',
extra: [
{
name: 'genre',
isRequired: false,
options: [] // Verrà popolato dinamicamente dai generi della playlist
},
{
name: 'search',
isRequired: false
},
{
name: 'skip',
isRequired: false
}
]
}
],
behaviorHints: {
configurationURL: null, // Verrà impostato dinamicamente
reloadRequired: true
}
}
};
function loadCustomConfig() {
const configOverridePath = path.join(__dirname, 'addon-config.json');
try {
const addonConfigExists = fs.existsSync(configOverridePath);
if (addonConfigExists) {
const customConfig = JSON.parse(fs.readFileSync(configOverridePath, 'utf8'));
const mergedConfig = {
...baseConfig,
manifest: {
...baseConfig.manifest,
id: customConfig.addonId || baseConfig.manifest.id,
name: customConfig.addonName || baseConfig.manifest.name,
description: customConfig.addonDescription || baseConfig.manifest.description,
version: customConfig.addonVersion || baseConfig.manifest.version,
logo: customConfig.addonLogo || baseConfig.manifest.logo,
behaviorHints: {
configurationURL: null, // Verrà impostato dinamicamente
reloadRequired: true
},
catalogs: [{
...baseConfig.manifest.catalogs[0],
id: addonConfigExists ? 'omg_plus_tv' : baseConfig.manifest.catalogs[0].id,
name: addonConfigExists ? 'OMG+ TV' : baseConfig.manifest.catalogs[0].name,
extra: [
{
name: 'genre',
isRequired: false,
options: [] // Verrà popolato dinamicamente dai generi della playlist
},
{
name: 'search',
isRequired: false
},
{
name: 'skip',
isRequired: false
}
]
}]
}
};
return mergedConfig;
}
} catch (error) {
console.error('Errore nel caricare la configurazione personalizzata:', error);
}
return baseConfig;
}
const config = loadCustomConfig();
module.exports = config;