Advice on starting new plugin that requires parsing XML
#1
I'm sure I have all the data/urls needed to get from channel list to stream, I'm just not sure exactly how to get this coded.
I can handle the Video plugin tutorial, and the audio plugin tutorial that involves reading from HTML tags using Beautiful Soup.

I pull down an XML file that has the channel entries with ID (used for stream lookup later) the Channel number, the name and the program/show name. I really only care about parsing the ID, the Channel Name and maybe the number (the original number from the IPTV service isn't really important, mostly it's the callsign/channel name I want)

When I have the ID, I pop the ID into another URL into the ?channel= value and that returns the RTMP stream URL for High Quality, Low Quality, and Audio only.

I'm not looking for someone to do this for me, just for some advice on any tutorials, plugins (Is Beautiful Soup the way to go?) or similar addons I could use for ideas.

This is the channel data format the item tag contains all the data about that one channel:
<item>
<id>123</id>
<number>5</number>
<name>
<![CDATA[ Channel Name ]]>
</name>
<category>0100</category>
<scate/>
<quality>SD</quality>
<program>
<![CDATA[ Show Name ]]>
</program>
<stime>0440</stime>
<charged>0</charged>
<fans>220297</fans>
<linkurl>
<![CDATA[ ]]>
</linkurl>
<playtype>0</playtype>
<weburl>
<![CDATA[ ]]>
</weburl>
<vodlike>off</vodlike>
</item>

And this is the returned stream profile format (it contains one for each of the 3 quality types)
<profile name="0" videosize="720*480" videobitrate="600" p2p="off" audiobitrate="96">
<path id="1">
<![CDATA[
rtmp://URL.BLAH.COM
]]>
</path>
</profile>
Reply
#2
This should help you get started for parsing XML https://docs.python.org/2/library/xml.et...ttree.html and I am sure there are other ways to approach this problem.
Reply
#3
(2016-03-26, 00:54)curti Wrote: This should help you get started for parsing XML https://docs.python.org/2/library/xml.et...ttree.html and I am sure there are other ways to approach this problem.

So far I've managed to tackle parsing that first xml that contains the channel list, but I keep running into unicode errors (the service is non-English). Both urllib and xbmcgui seem to have problems with the utf-8 non-ascii characters in the data.

urllib will actually throw errors, but xbmcgui just basically just leaves the non-ascii channel names as blank (some are English characters and show fine).

I've really just mucked around with your Audio "how-to" example plugin at this point, single it has soup and some parsing in it. Once I get things straightened out I'll build up from scratch, especially since that was for audio instead of video.
Reply
#4
If you are having issues with utf-8 you should see this page: http://kodi.wiki/view/Add-on_unicode_paths
Reply

Logout Mark Read Team Forum Stats Members Help
Advice on starting new plugin that requires parsing XML0