mirror of
https://github.com/iptv-org/epg
synced 2025-12-17 10:56:57 -05:00
Change line endings with CRLF
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
site: '<DOMAIN>',
|
site: '<DOMAIN>',
|
||||||
url({ channel, date }) {
|
url({ channel, date }) {
|
||||||
return `https://example.com/api/${channel.site_id}/${date.format('YYYY-MM-DD')}`
|
return `https://example.com/api/${channel.site_id}/${date.format('YYYY-MM-DD')}`
|
||||||
},
|
},
|
||||||
parser({ content }) {
|
parser({ content }) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(content)
|
return JSON.parse(content)
|
||||||
} catch {
|
} catch {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
channels() {
|
channels() {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
# <DOMAIN>
|
# <DOMAIN>
|
||||||
|
|
||||||
https://<DOMAIN>
|
https://<DOMAIN>
|
||||||
|
|
||||||
### Download the guide
|
### Download the guide
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run grab --- --site=<DOMAIN>
|
npm run grab --- --site=<DOMAIN>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Update channel list
|
### Update channel list
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run channels:parse --- --config=./sites/<DOMAIN>/<DOMAIN>.config.js --output=./sites/<DOMAIN>/<DOMAIN>.channels.xml
|
npm run channels:parse --- --config=./sites/<DOMAIN>/<DOMAIN>.config.js --output=./sites/<DOMAIN>/<DOMAIN>.channels.xml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test
|
### Test
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm test --- <DOMAIN>
|
npm test --- <DOMAIN>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Sites
|
# Sites
|
||||||
|
|
||||||
_TABLE_
|
_TABLE_
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
const { parser, url } = require('./<DOMAIN>.config.js')
|
const { parser, url } = require('./<DOMAIN>.config.js')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
const date = dayjs.utc('2025-01-12', 'YYYY-MM-DD').startOf('d')
|
const date = dayjs.utc('2025-01-12', 'YYYY-MM-DD').startOf('d')
|
||||||
const channel = { site_id: 'bbc1' }
|
const channel = { site_id: 'bbc1' }
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
expect(url({ channel, date })).toBe('https://example.com/api/bbc1/2025-01-12')
|
expect(url({ channel, date })).toBe('https://example.com/api/bbc1/2025-01-12')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content =
|
const content =
|
||||||
'[{"title":"Program 1","start":"2025-01-12T00:00:00.000Z","stop":"2025-01-12T00:30:00.000Z"},{"title":"Program 2","start":"2025-01-12T00:30:00.000Z","stop":"2025-01-12T01:00:00.000Z"}]'
|
'[{"title":"Program 1","start":"2025-01-12T00:00:00.000Z","stop":"2025-01-12T00:30:00.000Z"},{"title":"Program 2","start":"2025-01-12T00:30:00.000Z","stop":"2025-01-12T01:00:00.000Z"}]'
|
||||||
|
|
||||||
const results = parser({ content })
|
const results = parser({ content })
|
||||||
|
|
||||||
expect(results.length).toBe(2)
|
expect(results.length).toBe(2)
|
||||||
expect(results[0]).toMatchObject({
|
expect(results[0]).toMatchObject({
|
||||||
title: 'Program 1',
|
title: 'Program 1',
|
||||||
start: '2025-01-12T00:00:00.000Z',
|
start: '2025-01-12T00:00:00.000Z',
|
||||||
stop: '2025-01-12T00:30:00.000Z'
|
stop: '2025-01-12T00:30:00.000Z'
|
||||||
})
|
})
|
||||||
expect(results[1]).toMatchObject({
|
expect(results[1]).toMatchObject({
|
||||||
title: 'Program 2',
|
title: 'Program 2',
|
||||||
start: '2025-01-12T00:30:00.000Z',
|
start: '2025-01-12T00:30:00.000Z',
|
||||||
stop: '2025-01-12T01:00:00.000Z'
|
stop: '2025-01-12T01:00:00.000Z'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can handle empty guide', () => {
|
it('can handle empty guide', () => {
|
||||||
const results = parser({ content: '' })
|
const results = parser({ content: '' })
|
||||||
|
|
||||||
expect(results).toMatchObject([])
|
expect(results).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
2
scripts/types/langs.d.ts
vendored
2
scripts/types/langs.d.ts
vendored
@@ -1 +1 @@
|
|||||||
declare module 'langs'
|
declare module 'langs'
|
||||||
|
|||||||
Reference in New Issue
Block a user