Update utils.js
Throws an error if a channel does not have a name
This commit is contained in:
parent
906cc97fb6
commit
ab027db13e
|
@ -60,6 +60,7 @@ utils.parseChannels = function (filename) {
|
||||||
.filter(el => el.name === 'channel')
|
.filter(el => el.name === 'channel')
|
||||||
.map(el => {
|
.map(el => {
|
||||||
const channel = el.attributes
|
const channel = el.attributes
|
||||||
|
if (!el.elements) throw new Error(`Channel '${channel.xmltv_id}' has no valid name`)
|
||||||
channel.name = el.elements.find(el => el.type === 'text').text
|
channel.name = el.elements.find(el => el.type === 'text').text
|
||||||
channel.site = channel.site || site.attributes.site
|
channel.site = channel.site || site.attributes.site
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue