@ygracs/xepg-lib-js 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -0
- package/LICENSE +9 -9
- package/index.js +1 -1
- package/lib/dts-helper.js +49 -15
- package/lib/xepgdoc-lib.js +57 -23
- package/package.json +19 -10
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#### *v0.0.17*
|
|
2
|
+
|
|
3
|
+
Pre-release version.
|
|
4
|
+
|
|
5
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.3;
|
|
6
|
+
> - updated dependency on `@ygracs/dtf-lib-js` module to v0.0.22;
|
|
7
|
+
> - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.14-rc4;
|
|
8
|
+
> - some fixes in `dts-helper.js` lib-module.
|
|
9
|
+
|
|
10
|
+
#### *v0.0.16*
|
|
11
|
+
|
|
12
|
+
Pre-release version.
|
|
13
|
+
|
|
14
|
+
> - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.14-rc3;
|
|
15
|
+
> - updated dependency on `@ygracs/dtf-lib-js` module to v0.0.21;
|
|
16
|
+
> - added `getDTSysDescr` function into `dts-helper.js` lib-module;
|
|
17
|
+
> - some fixes in `dts-helper.js` lib-module;
|
|
18
|
+
> - some fixes in `xepgdoc-lib.js` module.
|
|
19
|
+
|
|
20
|
+
#### *v0.0.15*
|
|
21
|
+
|
|
22
|
+
Pre-release version.
|
|
23
|
+
|
|
24
|
+
> - `xepgdoc-spec.md` updated;
|
|
25
|
+
> - `xepgdoc-lib.md` updated;
|
|
26
|
+
> - removed property `SchedulesQty` for `TXEpgSchedulesList` class;
|
|
27
|
+
> - some changes upon a class constructor options (deprecated settings which sets the rules of an element tag naming).
|
|
28
|
+
|
|
29
|
+
#### *v0.0.14*
|
|
30
|
+
|
|
31
|
+
Pre-release version.
|
|
32
|
+
|
|
33
|
+
> - added dependency on `@ygracs/dtf-lib-js` module;
|
|
34
|
+
> - `$module/lib/dts-helper.js` updated;
|
|
35
|
+
> - `$module/lib/xepgdoc-lib.js` updated;
|
|
36
|
+
> - `$module/lib/dtFunc.js` removed.
|
|
37
|
+
|
|
38
|
+
#### *v0.0.13*
|
|
39
|
+
|
|
40
|
+
Pre-release version.
|
|
41
|
+
|
|
42
|
+
> - updated `dtFunc.js` lib-module to v0.1.019-20220903;
|
|
43
|
+
> - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.13;
|
|
44
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.2.
|
|
45
|
+
|
|
46
|
+
#### *v0.0.12*
|
|
47
|
+
|
|
48
|
+
Pre-release version.
|
|
49
|
+
|
|
50
|
+
> - switch dependency from `@cntwg/xml-lib-js` module to `@ygracs/xobj-lib-js` module;
|
|
51
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.1.
|
|
52
|
+
|
|
53
|
+
#### *v0.0.11*
|
|
54
|
+
|
|
55
|
+
Pre-release version.
|
|
56
|
+
|
|
57
|
+
> - `xepgdoc-lib.md` updated;
|
|
58
|
+
> - some fixes in `dts-helper.js` lib-module;
|
|
59
|
+
> - some fixes in `dtFunc.js` lib-module;
|
|
60
|
+
> - some fixes in `xepgdoc-lib.js` module;
|
|
61
|
+
> - add property `schedQty` to `TXEpgSchedulesList` class;
|
|
62
|
+
> - add property `dts` to `TXEpgHeaderContainer` class;
|
|
63
|
+
> - add property `dts` to `TXEpgContentContainer` class;
|
|
64
|
+
> - add `TXepgDTSProvider` class;
|
|
65
|
+
> - deprecate property `SchedulesQty` of `TXEpgSchedulesList` class.
|
|
66
|
+
|
|
67
|
+
#### *v0.0.10*
|
|
68
|
+
|
|
69
|
+
Pre-release version.
|
|
70
|
+
|
|
71
|
+
> - some fixes in `xepgdoc-lib.js` module.
|
|
72
|
+
|
|
73
|
+
#### *v0.0.9*
|
|
74
|
+
|
|
75
|
+
Pre-release version.
|
|
76
|
+
|
|
77
|
+
> - `xepgdoc-lib.md` updated;
|
|
78
|
+
> - `xepgdoc-spec.md` updated;
|
|
79
|
+
> - some fixes in `xepgdoc-lib.js` module;
|
|
80
|
+
> - some fixes in `dtFunc.js` module;
|
|
81
|
+
> - `$module/lib/dts-helper.js` added;
|
|
82
|
+
> - move module `xepgdoc-lib-v2.js` to its own project;
|
|
83
|
+
> - updated dependency on `@cntwg/xml-lib-js` module to v0.0.13;
|
|
84
|
+
> - updated dependency on `@ygracs/xml-js6` module to v0.0.3b.
|
|
85
|
+
|
|
86
|
+
#### *v0.0.8*
|
|
87
|
+
|
|
88
|
+
Pre-release version.
|
|
89
|
+
|
|
90
|
+
> - updated dependency on `@cntwg/xml-lib-js` module to v0.0.10;
|
|
91
|
+
> - switch dependency from `@cntwg/bsfoc-lib-js` module to `@ygracs/bsfoc-lib-js` module.
|
|
92
|
+
|
|
93
|
+
#### *v0.0.7*
|
|
94
|
+
|
|
95
|
+
Pre-release version.
|
|
96
|
+
|
|
97
|
+
> - updated dependency on `@cntwg/bsfoc-lib-js` module to v0.0.11;
|
|
98
|
+
> - updated dependency on `@cntwg/xml-lib-js` module to v0.0.9.
|
|
99
|
+
|
|
100
|
+
#### *v0.0.6*
|
|
101
|
+
|
|
102
|
+
Pre-release version.
|
|
103
|
+
|
|
104
|
+
> - some fixes in `xepgdoc-lib.js` module.
|
|
105
|
+
|
|
106
|
+
#### *v0.0.5*
|
|
107
|
+
|
|
108
|
+
Pre-release version.
|
|
109
|
+
|
|
110
|
+
> - updated dependency on `@cntwg/bsfoc-lib-js` module to v0.0.8;
|
|
111
|
+
> - updated dependency on `@cntwg/xml-lib-js` module to v0.0.8;
|
|
112
|
+
> - add method `loadFromFileSync` to `TXEpgContentProvider` (v1);
|
|
113
|
+
> - add method `saveToFileSync` to `TXEpgContentProvider` (v1);
|
|
114
|
+
> - some fixes in `xepgdoc-lib.js` module;
|
|
115
|
+
> - `$module/lib/xepgdoc-lib-v2.js` added;
|
|
116
|
+
> - `xepgdoc-lib-v2.md` added;
|
|
117
|
+
> - `xepgdoc-spec.md` added.
|
|
118
|
+
|
|
119
|
+
#### *v0.0.4*
|
|
120
|
+
|
|
121
|
+
Pre-release version.
|
|
122
|
+
|
|
123
|
+
> - removed class `TXEpgContentBodyContainer` from `xepgdoc-lib.js` module;
|
|
124
|
+
> - merdged class `TXEpgContentContainer` into `TXEpgContentProvider`;
|
|
125
|
+
> - `xepgdoc-lib.md` added.
|
|
126
|
+
|
|
127
|
+
#### *v0.0.3*
|
|
128
|
+
|
|
129
|
+
Pre-release version.
|
|
130
|
+
|
|
131
|
+
> - updated dependency on `@cntwg/xml-lib-js` module to v0.0.7;
|
|
132
|
+
> - renamed class `TXEpgScheduleContainer` to `TXEpgSchedulesList`;
|
|
133
|
+
> - `xepgdoc-lib.md` added;
|
|
134
|
+
> - MIT-license applied.
|
|
135
|
+
|
|
136
|
+
#### *v0.0.2*
|
|
137
|
+
|
|
138
|
+
Pre-release version.
|
|
139
|
+
|
|
140
|
+
> - fixed some errors in `xepgdoc-lib.js` module.
|
|
141
|
+
|
|
142
|
+
#### *v0.0.1*
|
|
143
|
+
|
|
144
|
+
Pre-release version.
|
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019-
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-2023 Yuri Grachev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/index.js
CHANGED
package/lib/dts-helper.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.043-20230711]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
valueToIndex, readAsString, readAsNumberEx,
|
|
7
|
+
isDateObject,
|
|
7
8
|
} = require('@ygracs/bsfoc-lib-js');
|
|
8
9
|
|
|
9
10
|
const {
|
|
@@ -33,49 +34,71 @@ function getDTSysName(value){
|
|
|
33
34
|
return result;
|
|
34
35
|
};
|
|
35
36
|
|
|
37
|
+
function getDTSysDescr(value){
|
|
38
|
+
let index = valueToIndex(value);
|
|
39
|
+
let name = 'undefined';
|
|
40
|
+
if (index !== -1) {
|
|
41
|
+
let result = def_dts_param[index];
|
|
42
|
+
if (result) name = result;
|
|
43
|
+
} else if (typeof value === 'string') {
|
|
44
|
+
let result = value.trim();
|
|
45
|
+
if (result !== '') {
|
|
46
|
+
index = def_dts_param.indexOf(result);
|
|
47
|
+
if (index !== -1) name = result;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
return { index, name };
|
|
51
|
+
};
|
|
52
|
+
|
|
36
53
|
function convStringToDTValue(value, dts_id, tz){
|
|
37
54
|
let result = 0;
|
|
38
55
|
let dtstype = valueToIndex(dts_id);
|
|
39
56
|
let dt_str = typeof value === 'string' ? value : '';
|
|
40
57
|
if (chkDTSysID(dtstype)) {
|
|
41
58
|
switch (getDTSysName(dtstype)) {
|
|
42
|
-
case 'default':
|
|
59
|
+
case 'default': {
|
|
43
60
|
// TODO: check TZ
|
|
44
61
|
//console.log('convStringToDTValue => dtstype:[default]');
|
|
45
62
|
result = (new Date(dt_str)).getTime();
|
|
46
63
|
//console.log('convStringToDTValue => value:['+value+']');
|
|
47
64
|
//console.log('convStringToDTValue => result:['+result+']');
|
|
48
65
|
break;
|
|
49
|
-
|
|
66
|
+
}
|
|
67
|
+
case 'iso8601': {
|
|
50
68
|
// TODO: check TZ
|
|
51
69
|
//console.log('convStringToDTValue => dtstype:[iso8601]');
|
|
52
70
|
result = (new Date(dt_str)).getTime();
|
|
53
71
|
//console.log('convStringToDTValue => value:['+value+']');
|
|
54
72
|
//console.log('convStringToDTValue => result:['+result+']');
|
|
55
73
|
break;
|
|
56
|
-
|
|
74
|
+
}
|
|
75
|
+
case 'xmltv': {
|
|
57
76
|
// TODO: check TZ
|
|
58
77
|
//console.log('convStringToDTValue => dtstype:[xmltv]');
|
|
59
78
|
result = (new Date(convXMLTVToDTValue(dt_str))).getTime();
|
|
60
79
|
//console.log('convStringToDTValue => value:['+value+']');
|
|
61
80
|
//console.log('convStringToDTValue => result:['+result+']');
|
|
62
81
|
break;
|
|
63
|
-
|
|
82
|
+
}
|
|
83
|
+
case 'timestamp': {
|
|
64
84
|
// TODO: check TZ
|
|
65
85
|
//console.log('convStringToDTValue => dtstype:[timestamp]');
|
|
66
86
|
result = Number(dt_str);
|
|
67
87
|
//console.log('convStringToDTValue => value:['+value+']');
|
|
68
88
|
//console.log('convStringToDTValue => result:['+result+']');
|
|
69
89
|
break;
|
|
70
|
-
|
|
90
|
+
}
|
|
91
|
+
case 'utc': {
|
|
71
92
|
// TODO: check TZ
|
|
72
93
|
//console.log('convStringToDTValue => dtstype:[utc]');
|
|
73
94
|
result = (new Date(Date.UTC(dt_str))).getTime();
|
|
74
95
|
//console.log('convStringToDTValue => value:['+value+']');
|
|
75
96
|
//console.log('convStringToDTValue => result:['+result+']');
|
|
76
97
|
break;
|
|
77
|
-
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
78
100
|
break;
|
|
101
|
+
}
|
|
79
102
|
};
|
|
80
103
|
if (Number.isNaN(result)) result = 0;
|
|
81
104
|
};
|
|
@@ -84,12 +107,16 @@ function convStringToDTValue(value, dts_id, tz){
|
|
|
84
107
|
|
|
85
108
|
function convDTValueToString(value, dts_id, tz){
|
|
86
109
|
let result = '';
|
|
87
|
-
let
|
|
88
|
-
|
|
110
|
+
let dt_val = (
|
|
111
|
+
isDateObject(value)
|
|
112
|
+
? value
|
|
113
|
+
: (new Date(readAsNumberEx(value, 0)))
|
|
114
|
+
).getTime();
|
|
89
115
|
if (Number.isNaN(dt_val)) dt_val = new Date(0);
|
|
116
|
+
let dtstype = valueToIndex(dts_id);
|
|
90
117
|
if (!chkDTSysID(dtstype)) dtstype = 0;
|
|
91
118
|
switch (getDTSysName(dtstype)) {
|
|
92
|
-
case 'default':
|
|
119
|
+
case 'default': {
|
|
93
120
|
// TODO: check TZ
|
|
94
121
|
//console.log('convDTValueToString => dtstype:[default]');
|
|
95
122
|
result = convDTValueToDateString(dt_val, {
|
|
@@ -98,17 +125,20 @@ function convDTValueToString(value, dts_id, tz){
|
|
|
98
125
|
//console.log('convDTValueToString => value:['+value+']');
|
|
99
126
|
//console.log('convDTValueToString => result:['+result+']');
|
|
100
127
|
break;
|
|
101
|
-
|
|
128
|
+
}
|
|
129
|
+
case 'iso8601': {
|
|
102
130
|
// TODO: check TZ
|
|
103
131
|
//console.log('convDTValueToString => dtstype:[iso8601]');
|
|
104
132
|
result = convDTValueToISO8601(dt_val, {
|
|
105
|
-
use_bs_format: false,
|
|
133
|
+
//use_bs_format: false,
|
|
134
|
+
useBaseFormat: false,
|
|
106
135
|
src_in_utc: false,
|
|
107
136
|
});
|
|
108
137
|
//console.log('convDTValueToString => value:['+value+']');
|
|
109
138
|
//console.log('convDTValueToString => result:['+result+']');
|
|
110
139
|
break;
|
|
111
|
-
|
|
140
|
+
}
|
|
141
|
+
case 'xmltv': {
|
|
112
142
|
// TODO: check TZ
|
|
113
143
|
//console.log('convDTValueToString => dtstype:[xmltv]');
|
|
114
144
|
result = convDTValueToXMLTV(dt_val, {
|
|
@@ -117,15 +147,18 @@ function convDTValueToString(value, dts_id, tz){
|
|
|
117
147
|
//console.log('convDTValueToString => value:['+value+']');
|
|
118
148
|
//console.log('convDTValueToString => result:['+result+']');
|
|
119
149
|
break;
|
|
120
|
-
|
|
150
|
+
}
|
|
151
|
+
case 'timestamp': {
|
|
121
152
|
// TODO: check TZ
|
|
122
153
|
//console.log('convDTValueToString => dtstype:[timestamp]');
|
|
123
154
|
result = dt_val.toString();
|
|
124
155
|
//console.log('convDTValueToString => value:['+value+']');
|
|
125
156
|
//console.log('convDTValueToString => result:['+result+']');
|
|
126
157
|
break;
|
|
127
|
-
|
|
158
|
+
}
|
|
159
|
+
default: {
|
|
128
160
|
break;
|
|
161
|
+
}
|
|
129
162
|
};
|
|
130
163
|
return result;
|
|
131
164
|
};
|
|
@@ -137,5 +170,6 @@ function convDTValueToString(value, dts_id, tz){
|
|
|
137
170
|
exports.chkDTSysID = chkDTSysID;
|
|
138
171
|
exports.checkDTSysID = chkDTSysID;
|
|
139
172
|
exports.getDTSysName = getDTSysName;
|
|
173
|
+
exports.getDTSysDescr = getDTSysDescr;
|
|
140
174
|
exports.convStringToDTValue = convStringToDTValue;
|
|
141
175
|
exports.convDTValueToString = convDTValueToString;
|
package/lib/xepgdoc-lib.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.054-20230326]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ const {
|
|
|
18
18
|
} = require('@ygracs/dtf-lib-js');
|
|
19
19
|
|
|
20
20
|
const {
|
|
21
|
-
chkDTSysID, getDTSysName,
|
|
21
|
+
chkDTSysID, getDTSysName, getDTSysDescr,
|
|
22
22
|
convStringToDTValue, convDTValueToString,
|
|
23
23
|
} = require('./dts-helper.js');
|
|
24
24
|
|
|
@@ -277,7 +277,11 @@ class TXEpgProviderContainer {
|
|
|
277
277
|
set version(value){
|
|
278
278
|
if (this.name !== '') {
|
|
279
279
|
const _value = typeof value === 'string' ? value.trim() : '';
|
|
280
|
-
const item = insertXObjElement(
|
|
280
|
+
const item = insertXObjElement(
|
|
281
|
+
this.#_content,
|
|
282
|
+
'version',
|
|
283
|
+
{ force: true },
|
|
284
|
+
);
|
|
281
285
|
if (item) writeXObjParam(item, _value);
|
|
282
286
|
};
|
|
283
287
|
}
|
|
@@ -288,7 +292,11 @@ class TXEpgProviderContainer {
|
|
|
288
292
|
|
|
289
293
|
set schema(value){
|
|
290
294
|
const _value = typeof value === 'string' ? value.trim() : '';
|
|
291
|
-
const item = insertXObjElement(
|
|
295
|
+
const item = insertXObjElement(
|
|
296
|
+
this.#_content,
|
|
297
|
+
XEPG_DOCSCH_ETAG_NAME,
|
|
298
|
+
{ force: true },
|
|
299
|
+
);
|
|
292
300
|
if (item) writeXObjParam(item, _value);
|
|
293
301
|
}
|
|
294
302
|
|
|
@@ -298,13 +306,17 @@ class TXEpgProviderContainer {
|
|
|
298
306
|
|
|
299
307
|
set doctype(value){
|
|
300
308
|
const _value = typeof value === 'string' ? value.trim() : '';
|
|
301
|
-
const item = insertXObjElement(
|
|
309
|
+
const item = insertXObjElement(
|
|
310
|
+
this.#_content,
|
|
311
|
+
XEPG_DOCTYP_ETAG_NAME,
|
|
312
|
+
{ force: true },
|
|
313
|
+
);
|
|
302
314
|
if (item) writeXObjParam(item, _value);
|
|
303
315
|
}
|
|
304
316
|
|
|
305
317
|
setName(value){
|
|
306
318
|
let isSUCCEED = false;
|
|
307
|
-
let item = insertXObjElement(this.#_content, 'name', true);
|
|
319
|
+
let item = insertXObjElement(this.#_content, 'name', { force: true });
|
|
308
320
|
if (item) {
|
|
309
321
|
const name = typeof value === 'string' ? value.trim() : '';
|
|
310
322
|
isSUCCEED = writeXObjParam(item, name);
|
|
@@ -413,14 +425,22 @@ class TXepgDTSProvider {
|
|
|
413
425
|
}
|
|
414
426
|
|
|
415
427
|
set dtstype(value){
|
|
416
|
-
|
|
417
|
-
|
|
428
|
+
let { index, name } = getDTSysDescr(value);
|
|
429
|
+
if (index !== -1) {
|
|
430
|
+
const item = insertXObjElement(
|
|
431
|
+
this.#_content,
|
|
432
|
+
XEPG_DTSINFO_ETAG_NAME,
|
|
433
|
+
{ force: true },
|
|
434
|
+
);
|
|
418
435
|
if (item) {
|
|
419
|
-
let
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
436
|
+
let curItem = insertXObjElement(item, 'value', { force: true });
|
|
437
|
+
if (
|
|
438
|
+
curItem
|
|
439
|
+
&& writeXObjParam(curItem, index)
|
|
440
|
+
&& (curItem = insertXObjElement(item, 'name', { force: true }))
|
|
441
|
+
) {
|
|
442
|
+
writeXObjParam(curItem, name);
|
|
443
|
+
};
|
|
424
444
|
};
|
|
425
445
|
};
|
|
426
446
|
}
|
|
@@ -432,8 +452,15 @@ class TXepgDTSProvider {
|
|
|
432
452
|
}
|
|
433
453
|
|
|
434
454
|
set curDocTZ(value){
|
|
435
|
-
let
|
|
436
|
-
if (
|
|
455
|
+
let _value = convValueToTZString(value);
|
|
456
|
+
if (_value !== '') {
|
|
457
|
+
let item = insertXObjElement(
|
|
458
|
+
this.#_content,
|
|
459
|
+
XEPG_DOCTZ_ETAG_NAME,
|
|
460
|
+
{ force: true },
|
|
461
|
+
);
|
|
462
|
+
if (item) writeXObjParam(item, _value);
|
|
463
|
+
};
|
|
437
464
|
}
|
|
438
465
|
|
|
439
466
|
};
|
|
@@ -516,9 +543,12 @@ class TXEpgHeaderContainer {
|
|
|
516
543
|
}
|
|
517
544
|
|
|
518
545
|
setDocumentDT(){
|
|
519
|
-
let
|
|
520
|
-
let
|
|
521
|
-
|
|
546
|
+
let dt_str = convDTValueToString(Date.now(), this.dtstype, this.curDocTZ);
|
|
547
|
+
let item = insertXObjElement(
|
|
548
|
+
this.#_content,
|
|
549
|
+
XEPG_DOCDTO_ETAG_NAME,
|
|
550
|
+
{ force: true },
|
|
551
|
+
);
|
|
522
552
|
if (item) writeXObjParam(item, dt_str);
|
|
523
553
|
}
|
|
524
554
|
|
|
@@ -534,7 +564,11 @@ class TXEpgHeaderContainer {
|
|
|
534
564
|
setDocumentEDT(value){
|
|
535
565
|
// TODO: check if value is a DateTime-string
|
|
536
566
|
let dt_str = convDTValueToString(value, this.dtstype, this.curDocTZ);
|
|
537
|
-
let item = insertXObjElement(
|
|
567
|
+
let item = insertXObjElement(
|
|
568
|
+
this.#_content,
|
|
569
|
+
XEPG_DOCDTE_ETAG_NAME,
|
|
570
|
+
{ force: true },
|
|
571
|
+
);
|
|
538
572
|
if (item) writeXObjParam(item, dt_str);
|
|
539
573
|
}
|
|
540
574
|
|
|
@@ -583,13 +617,13 @@ class TXEpgHeaderContainer {
|
|
|
583
617
|
};
|
|
584
618
|
let item = null;
|
|
585
619
|
const _content = this.#_content;
|
|
586
|
-
item = insertXObjElement(_content, XEPG_CHNID_ETAG_NAME, true);
|
|
620
|
+
item = insertXObjElement(_content, XEPG_CHNID_ETAG_NAME, { force: true });
|
|
587
621
|
if (item) writeXObjParam(item, chnid);
|
|
588
|
-
item = insertXObjElement(_content, XEPG_CHNNAME_ETAG_NAME, true);
|
|
622
|
+
item = insertXObjElement(_content, XEPG_CHNNAME_ETAG_NAME, { force: true });
|
|
589
623
|
if (item) writeXObjParam(item, chname);
|
|
590
|
-
item = insertXObjElement(_content, XEPG_CHNGID_ETAG_NAME, true);
|
|
624
|
+
item = insertXObjElement(_content, XEPG_CHNGID_ETAG_NAME, { force: true });
|
|
591
625
|
if (item) writeXObjParam(item, chngid);
|
|
592
|
-
item = insertXObjElement(_content, XEPG_CHNURL_ETAG_NAME, true);
|
|
626
|
+
item = insertXObjElement(_content, XEPG_CHNURL_ETAG_NAME, { force: true });
|
|
593
627
|
if (item) writeXObjParam(item, srcurl);
|
|
594
628
|
}
|
|
595
629
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ygracs/xepg-lib-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "A library for handling an EPG-sources based on an XEPG-format",
|
|
5
5
|
"author": "ygracs <cs70th-om@rambler.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,24 +15,33 @@
|
|
|
15
15
|
"doc/xepgdoc-example.xepg",
|
|
16
16
|
"lib/xepgdoc-lib.js",
|
|
17
17
|
"lib/dts-helper.js",
|
|
18
|
-
"index.js"
|
|
18
|
+
"index.js",
|
|
19
|
+
"CHANGELOG.md"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
|
-
"test": "jest",
|
|
22
|
-
"test-xepg": "jest ./test",
|
|
22
|
+
"test": "cross-env TZ='Etc/UTC' jest",
|
|
23
|
+
"test-xepg": "TZ='Etc/UTC' jest ./test",
|
|
23
24
|
"test-xepg:sl": "jest TXEpgSchedulesList",
|
|
24
|
-
"test-xepg:hc": "jest TXEpgHeader",
|
|
25
|
+
"test-xepg:hc": "TZ='Etc/UTC' jest TXEpgHeader",
|
|
25
26
|
"test-xepg:pc": "jest TXEpgProvider",
|
|
26
27
|
"test-xepg:dts": "jest TXEpgDTS",
|
|
27
|
-
"test-xepg:cp": "jest TXEpgContentProvider"
|
|
28
|
+
"test-xepg:cp": "jest TXEpgContentProvider",
|
|
29
|
+
"win:test": "set TZ='Etc/UTC' && jest",
|
|
30
|
+
"win:test-xepg": "set TZ='Etc/UTC' && jest ./test",
|
|
31
|
+
"win:test-xepg:hc": "set TZ='Etc/UTC' && jest TXEpgHeader"
|
|
32
|
+
},
|
|
33
|
+
"imports": {
|
|
34
|
+
"#lib/*": "./lib/*"
|
|
28
35
|
},
|
|
29
36
|
"dependencies": {
|
|
30
|
-
"@ygracs/bsfoc-lib-js": "^0.1.
|
|
31
|
-
"@ygracs/dtf-lib-js": "^0.0.
|
|
37
|
+
"@ygracs/bsfoc-lib-js": "^0.1.3",
|
|
38
|
+
"@ygracs/dtf-lib-js": "^0.0.22",
|
|
32
39
|
"@ygracs/xml-js6": "^0.0.3-b",
|
|
33
|
-
"@ygracs/xobj-lib-js": "^0.0.
|
|
40
|
+
"@ygracs/xobj-lib-js": "^0.0.14-rc4"
|
|
34
41
|
},
|
|
35
42
|
"devDependencies": {
|
|
36
|
-
"
|
|
43
|
+
"cross-env": "^7.0.3",
|
|
44
|
+
"jest": "^29.6.1",
|
|
45
|
+
"minimist": "^1.2.8"
|
|
37
46
|
}
|
|
38
47
|
}
|