1
0
Fork 0

accepts half-baked shows files

this makes the similarity with XBEL a bit better
This commit is contained in:
boyska 2022-01-30 00:42:18 +01:00
parent 0d79eb615d
commit eab5da1ec7

View file

@ -254,16 +254,22 @@ function parseRadioShows(xml) {
for (let i = 0; i < bookmarks.snapshotLength; i++) {
const bm = bookmarks.snapshotItem(i)
const name = doc.evaluate('./info/metadata/show:name', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
const website = doc.evaluate('./info/metadata/show:website', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
let name = doc.evaluate('./info/metadata/show:name', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
if (name === '') {
name = doc.evaluate('./title', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
}
let website = doc.evaluate('./info/metadata/show:website', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
if (website === '') {
website = getAttribute(bm, 'href', null)
}
const feed = doc.evaluate('./info/metadata/show:feed', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
const schedule = doc.evaluate('./info/metadata/show:schedule', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
let description = doc.evaluate('./info/metadata/show:description', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
if(description === '') {
description = doc.evaluate('./description', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
if (description === '') {
description = doc.evaluate('./desc', bm, showsNamespaceResolver, XPathResult.STRING_TYPE).stringValue
}
const show = new RadioShow(name || null, description, website || null, feed || null, schedule || null)
const show = new RadioShow(name, description || null, website || null, feed || null, schedule || null)
shows.push(show)
}