5 from plugins.modules.PlaylistGenerator import PlaylistGenerator
7 tvguide_url="http://www.teleguide.info/download/new3/jtv.zip"
9 def parseXML(filename):
10 datasource = open(filename)
11 return xml.dom.minidom.parse(datasource) # parse an open file
15 nodelist = element.childNodes
17 if node.nodeType == node.TEXT_NODE:
23 sys.stderr.write("Usage: %s <xml-file>\n" % (argv[0],))
26 if not os.path.exists(argv[1]):
27 sys.stderr.write("ERROR: Channel file %r was not found!\n" % (argv[1],))
30 dom = parseXML(argv[1])
31 tracklist = dom.getElementsByTagName('playlist')[0].getElementsByTagName('trackList')[0].getElementsByTagName('track')
33 channels = PlaylistGenerator()
35 for track in tracklist:
39 channel['name'] = getText(track.getElementsByTagName('title')[0])
40 channel['url'] = getText(track.getElementsByTagName('location')[0])
42 channel['logo'] = getText(track.getElementsByTagName('image')[0])
46 channel['country'] = getText(track.getElementsByTagName('country')[0])
50 channel['group'] = getText(track.getElementsByTagName('category')[0])
54 channels.addItem(channel)
56 print channels.dumpm3u().encode('utf8')
58 if __name__ == "__main__":
59 sys.exit(main(sys.argv))