epg-grabber 0.17.0 → 0.17.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epg-grabber",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Node.js CLI tool for grabbing EPG from different sites",
5
5
  "main": "src/index.js",
6
6
  "preferGlobal": true,
package/src/utils.js CHANGED
@@ -295,6 +295,8 @@ utils.parsePrograms = async function (data, config) {
295
295
  title: program.title,
296
296
  description: program.description || null,
297
297
  category: program.category || null,
298
+ season: program.season || null,
299
+ episode: program.episode || null,
298
300
  icon: program.icon || null,
299
301
  channel: channel.xmltv_id,
300
302
  lang: program.lang || channel.lang || config.lang || 'en',
@@ -1,3 +1,8 @@
1
+ const dayjs = require('dayjs')
2
+ const utc = require('dayjs/plugin/utc')
3
+
4
+ dayjs.extend(utc)
5
+
1
6
  module.exports = {
2
7
  site: 'example.com',
3
8
  ignore: true,
@@ -14,6 +19,20 @@ module.exports = {
14
19
  return { accountID: '123' }
15
20
  }
16
21
  },
17
- parser: () => [],
22
+ parser: () => {
23
+ return [
24
+ {
25
+ title: 'Title',
26
+ description: 'Description',
27
+ lang: 'en',
28
+ category: ['Category1', 'Category2'],
29
+ icon: 'https://example.com/image.jpg',
30
+ season: 9,
31
+ episode: 238,
32
+ start: dayjs.utc('2022-01-01 00:00:00'),
33
+ stop: dayjs.utc('2022-01-01 01:00:00')
34
+ }
35
+ ]
36
+ },
18
37
  logo: () => 'http://example.com/logos/1TV.png?x=шеллы&sid=777'
19
38
  }
@@ -198,6 +198,28 @@ it('can load logo async', done => {
198
198
  })
199
199
  })
200
200
 
201
+ it('can parse programs', done => {
202
+ const config = utils.loadConfig(require(path.resolve('./tests/input/example.com.config.js')))
203
+ return utils
204
+ .parsePrograms({ channel: { xmltv_id: '1tv', lang: 'en' } }, config)
205
+ .then(programs => {
206
+ expect(programs).toMatchObject([
207
+ {
208
+ title: 'Title',
209
+ description: 'Description',
210
+ lang: 'en',
211
+ category: ['Category1', 'Category2'],
212
+ icon: 'https://example.com/image.jpg',
213
+ season: 9,
214
+ episode: 238,
215
+ start: 1640995200,
216
+ stop: 1640998800
217
+ }
218
+ ])
219
+ done()
220
+ })
221
+ })
222
+
201
223
  it('can parse programs async', done => {
202
224
  const config = utils.loadConfig(require(path.resolve('./tests/input/async.config.js')))
203
225
  return utils