Renamed channel.id to channel.xmltv_id
This commit is contained in:
parent
19d206c11c
commit
d5ed0a35ee
|
@ -1,7 +1,7 @@
|
|||
class Channel {
|
||||
constructor(c) {
|
||||
const data = {
|
||||
id: c.id || c.xmltv_id,
|
||||
xmltv_id: c.xmltv_id,
|
||||
name: c.name,
|
||||
site: c.site || '',
|
||||
site_id: c.site_id,
|
||||
|
|
|
@ -10,7 +10,7 @@ class Program {
|
|||
|
||||
const data = {
|
||||
site: c.site || '',
|
||||
channel: c.id || '',
|
||||
channel: c.xmltv_id || '',
|
||||
titles: toArray(p.titles || p.title).map(text => toTextObject(text, c.lang)),
|
||||
sub_titles: toArray(p.sub_titles || p.sub_title).map(text => toTextObject(text, c.lang)),
|
||||
descriptions: toArray(p.descriptions || p.description || p.desc).map(text =>
|
||||
|
|
|
@ -29,7 +29,7 @@ function createElements(channels, programs, date) {
|
|||
...channels.map(channel => {
|
||||
return (
|
||||
'\r\n' +
|
||||
el('channel', { id: channel.id }, [
|
||||
el('channel', { id: channel.xmltv_id }, [
|
||||
el('display-name', {}, [escapeString(channel.name)]),
|
||||
el('icon', { src: channel.logo }),
|
||||
el('url', {}, [channel.url])
|
||||
|
|
|
@ -12,28 +12,7 @@ it('can create new Channel', () => {
|
|||
|
||||
expect(channel).toMatchObject({
|
||||
name: '1 TV',
|
||||
id: '1TV.com',
|
||||
site_id: '1',
|
||||
site: 'example.com',
|
||||
url: 'https://example.com',
|
||||
lang: 'fr',
|
||||
logo: 'https://example.com/logos/1TV.png'
|
||||
})
|
||||
})
|
||||
|
||||
it('can create channel from exist object', () => {
|
||||
const channel = new Channel({
|
||||
name: '1 TV',
|
||||
id: '1TV.com',
|
||||
site_id: '1',
|
||||
site: 'example.com',
|
||||
lang: 'fr',
|
||||
logo: 'https://example.com/logos/1TV.png'
|
||||
})
|
||||
|
||||
expect(channel).toMatchObject({
|
||||
name: '1 TV',
|
||||
id: '1TV.com',
|
||||
xmltv_id: '1TV.com',
|
||||
site_id: '1',
|
||||
site: 'example.com',
|
||||
url: 'https://example.com',
|
||||
|
|
|
@ -71,7 +71,7 @@ it('can produce multiple outputs', () => {
|
|||
`node ${pwd}/bin/epg-grabber.js \
|
||||
--config=tests/__data__/input/mini.config.js \
|
||||
--channels=tests/__data__/input/example.channels.xml \
|
||||
--output=tests/__data__/output/{lang}/{id}.xml`,
|
||||
--output=tests/__data__/output/{lang}/{xmltv_id}.xml`,
|
||||
{
|
||||
encoding: 'utf8'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue