forked from boyska/radiomanifest.js
accepts half-baked shows files
this makes the similarity with XBEL a bit better
This commit is contained in:
parent
0d79eb615d
commit
eab5da1ec7
1 changed files with 11 additions and 5 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue