xml = CreateObject("roXMLElement")
if xml.Parse(raw)
for each item in xml.channel.item
newItem = {
guid: ValidStr(item.guid.GetText())
streams: []
streamFormat: "mp4"
minBandwidth: 250
'maxBandwidth: 2200
actors: []
categories: []
contentType: "episode"
bookmarkPosition: 0
}
' title
tmp = item.GetNamedElements("media:title")
if tmp.Count() > 0
newItem.title = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))
newItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))
else
newItem.title = util.HTMLEntityDecode(ValidStr(item.title.GetText()))
newItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(item.title.GetText()))
end if
' media:content can be a child of <item> or of <media:group>
contentItems = item.GetNamedElements("media:content")
if contentItems.Count() = 0
tmp = item.GetNamedElements("media:group")
if tmp.Count() > 0
contentItems = tmp.GetNamedElements("media:content")
end if
end if
' length
tmp = item.GetNamedElements("blip:runtime")
if tmp.Count() > 0
length = StrToI(ValidStr(tmp[0].GetText()))
if length > 0
newItem.length = length
end if
end if
if contentItems.Count() > 0
for each content in contentItems
if ValidStr(content@url) <> ""
newStream = {
url: ValidStr(content@url)
bitrate: StrToI(ValidStr(content@bitrate))
contentID: contentIDPrefix + "|" + newItem.title
}
' use the content's height attribute to determine HD-ness
if StrToI(ValidStr(content@height)) > 720
newStream.quality = true
newItem.HDBranded = true
newItem.isHD = true
newItem.fullHD = true
else if StrToI(ValidStr(content@height)) > 480
newStream.quality = true
newItem.HDBranded = true
newItem.isHD = true
end if
newItem.streams.push(newStream)
end if
next
length = StrToI(ValidStr(contentItems[0]@duration))
if newItem.length = invalid and length > 0
newItem.length = length
end if
"axiomy" wrote:
I am assuming I will need to add code to the "media:content" section to correctly parse the type="video/hls" tag?
if item.enclosure@type = "application/x-mpegURL" or LCase (Right (url, 4)) = ".M3U8"
newItem.streamFormat = "hls"
else if item.enclosure@type = "video/MP2T" or LCase (Right (url, 4)) = ".ts"
newItem.streamFormat = "hls"
' we didn't find any media:content tags, try the enclosure tagright above the code I added so it would play mp3 audio and shoutcast. The Audio plays fine but the hls will not load.
url = ValidStr(item.enclosure@url)
if item.enclosure@type = "application/x-mpegURL" or LCase (Right (url, 4)) = ".m3u8"
newItem.streamFormat = "hls"
else if item.enclosure@type = "audio/mpeg" or LCase (Right (url, 4)) = ".mp3"
newItem.streamFormat = "mp3"
newItem.url = url
else
newStream = {
url: ValidStr(item.enclosure@url)
}
newItem.streams.Push(newStream)
endif
'PrintAA(newItem)
result.Push(newItem)
end if
next
end if
return result
end function
guid: ValidStr(item.guid.GetText())
streams: []
streamFormat: "mp4"
minBandwidth: 880
'maxBandwidth: 2200
actors: []
categories: []
contentType: "episode"
bookmarkPosition: 0