diff --git a/radiomanifest.js b/radiomanifest.js index 3f11c06..67b77b3 100644 --- a/radiomanifest.js +++ b/radiomanifest.js @@ -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) }