diff --git a/scripts/core/queueCreator.ts b/scripts/core/queueCreator.ts index 2816f57f..1a906f9d 100644 --- a/scripts/core/queueCreator.ts +++ b/scripts/core/queueCreator.ts @@ -43,12 +43,14 @@ export class QueueCreator { const config: SiteConfig = await this.configLoader.load(configPath) if (channel.xmltv_id) { - const found: ApiChannel = channels.first( - (_channel: ApiChannel) => _channel.id === channel.xmltv_id - ) - if (found) { - channel.icon = found.logo - channel.name = found.name + if (!channel.icon) { + const found: ApiChannel = channels.first( + (_channel: ApiChannel) => _channel.id === channel.xmltv_id + ) + + if (found) { + channel.icon = found.logo + } } } else { channel.xmltv_id = channel.site_id diff --git a/tests/__data__/expected/custom_guide.xml b/tests/__data__/expected/custom_guide.xml new file mode 100644 index 00000000..41efdac8 --- /dev/null +++ b/tests/__data__/expected/custom_guide.xml @@ -0,0 +1,17 @@ + +Custom Channel 1https://example.com +Channel 1https://example2.com +Custom Channel 2https://example.com +Channel 3https://example2.com +Channel 4https://example2.com +Program1 (example.com) +Programme1 (example.com) +Programme1 (example2.com) +Program1 (example.com) +Programme1 (example.com) +Programme1 (example2.com) +Program1 (example2.com) +Program1 (example2.com) +Program1 (example2.com) +Program1 (example2.com) + \ No newline at end of file diff --git a/tests/__data__/expected/guide.xml b/tests/__data__/expected/guide.xml index 242bc2ff..3de58428 100644 --- a/tests/__data__/expected/guide.xml +++ b/tests/__data__/expected/guide.xml @@ -1,8 +1,8 @@ Channel 1https://example.com Channel 1https://example2.com -Channel 2https://example.com -Channel 3https://example2.com +Channel 2https://example.com +Channel 3https://example2.com Channel 4https://example2.com Program1 (example.com) Programme1 (example.com) diff --git a/tests/__data__/expected/guide.xml.gz b/tests/__data__/expected/guide.xml.gz index 036c0841..e634dcdf 100644 Binary files a/tests/__data__/expected/guide.xml.gz and b/tests/__data__/expected/guide.xml.gz differ diff --git a/tests/__data__/expected/guide2.xml b/tests/__data__/expected/guide2.xml index b358b044..ff7119fd 100644 --- a/tests/__data__/expected/guide2.xml +++ b/tests/__data__/expected/guide2.xml @@ -1,6 +1,6 @@ Channel 1https://example.com -Channel 2https://example.com +Channel 2https://example.com Program1 (example.com) Programme1 (example.com) Program1 (example.com) diff --git a/tests/__data__/expected/guides/en/example.com.xml b/tests/__data__/expected/guides/en/example.com.xml index 2d958ef6..f3550b8c 100644 --- a/tests/__data__/expected/guides/en/example.com.xml +++ b/tests/__data__/expected/guides/en/example.com.xml @@ -1,6 +1,6 @@ Channel 1https://example.com -Channel 2https://example.com +Channel 2https://example.com Program1 (example.com) Program1 (example.com) \ No newline at end of file diff --git a/tests/__data__/input/epg-grab/custom.channels.xml b/tests/__data__/input/epg-grab/custom.channels.xml index f32419c6..9b78a7ae 100644 --- a/tests/__data__/input/epg-grab/custom.channels.xml +++ b/tests/__data__/input/epg-grab/custom.channels.xml @@ -1,7 +1,7 @@ - Channel 1 - Channel 2 + Custom Channel 1 + Custom Channel 2 Channel 1 Channel 3 Channel 4 diff --git a/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml b/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml index 7f81064b..1b037f02 100644 --- a/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml +++ b/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml @@ -1,6 +1,6 @@ Channel 1 - Channel 2 + Channel 2 Channel 1 \ No newline at end of file diff --git a/tests/__data__/input/temp/data/channels.json b/tests/__data__/input/temp/data/channels.json index 28255c4a..4ff2f615 100644 --- a/tests/__data__/input/temp/data/channels.json +++ b/tests/__data__/input/temp/data/channels.json @@ -70,5 +70,7 @@ "categories": [], "is_nsfw": false, "logo": "https://www.directv.com/images/logos/channels/dark/large/579.png" - } + }, + {"id":"Channel2.us","name":"Channel 2 [API]","alt_names":[],"network":null,"owners":[],"country":"UK","subdivision":null,"city":null,"broadcast_area":["c/US"],"languages":["eng"],"categories":[],"is_nsfw":false,"launched":null,"closed":null,"replaced_by":null,"website":"","logo":"https://i.imgur.com/rPzH88J.png"}, + {"id":"Channel3.us","name":"Channel 3 [API]","alt_names":[],"network":null,"owners":[],"country":"UK","subdivision":null,"city":null,"broadcast_area":["c/US"],"languages":["eng"],"categories":[],"is_nsfw":false,"launched":null,"closed":null,"replaced_by":null,"website":"","logo":"https://upload.wikimedia.org/wikipedia/commons/6/64/6%27eren_2015.png"} ] \ No newline at end of file diff --git a/tests/commands/epg/grab.test.ts b/tests/commands/epg/grab.test.ts index d580f265..8d40f16f 100644 --- a/tests/commands/epg/grab.test.ts +++ b/tests/commands/epg/grab.test.ts @@ -86,7 +86,7 @@ describe('epg:grab', () => { if (process.env.DEBUG === 'true') console.log(cmd, stdout) expect(content('tests/__data__/output/guide.xml')).toEqual( - content('tests/__data__/expected/guide.xml') + content('tests/__data__/expected/custom_guide.xml') ) })