|
SageTV EPG Service Discussion related to the SageTV EPG Service used within SageTV. Questions about service area coverage, channel lineups, EPG listings, XMLTV, or anything else related to the service or programming guide data for SageTV should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
need guidance on XML parsing
Hello, looking for some help to modify this code/script;
Code:
1 import datetime 2 3 CHANNELS = {} 4 5 #################################################################################################### 6 def initchannels(xmlguide): 7 channels = {} 8 for key in xmlguide: 9 channel = {} 10 channels[0] = channel 11 12 CHANNELS = channels 13 14 15 def format_time(timestamp): 16 return datetime.datetime.strptime(timestamp[:12], "%Y%m%d%H%M%S") 17 18 19 #################################################################################################### 20 def epgguide(channelID, currentTime): 21 epgInfo = 'No EPG Info Available' 22 #Log("currenttime ---------------- " + str(currentTime)) 23 try: 24 for channel in CHANNELS: 25 if channel.id in channelID: 26 for prog in channel: 27 if int(currentTime) > int(format_time(prog.key['start'])) and int(currentTime)+120 < int(format_time(prog.key['stop'])): 28 epgInfo = epgInfo + ' | ' + prog + '[ ' + format_time(key['start']) + ' - ' + format_time(key['stop']) + ' ]' 29 except: 30 pass 31 return epgInfo Thank you |
#2
|
|||
|
|||
I would like it to;
a) Init function [def initchannels(xmlguide)] that parses the 'guide.xml' at the start when Refreshing Channel Listing is called b) Get Channel content based on current time [def epgguide(channelID, currentTime)] Thank you |
#3
|
||||
|
||||
That looks like python, I'd take a look at some of the python xml parsers. sax is probably a good start since you want to parse the whole XML on init.
https://docs.python.org/2/library/xml.html |
#4
|
|||
|
|||
Ok, I'll check with some Python programmers. Thx
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with Parsing error | PLUCKYHD | SageTV Studio | 2 | 05-06-2009 08:08 AM |
6.1.4 Metadata Properties Parsing | JREkiwi | SageTV Beta Test Software | 35 | 03-10-2007 08:39 PM |
Two Questions. H.264 and Tag Parsing | kranzel | SageTV Software | 0 | 01-16-2007 04:20 AM |
XML Parsing Library (Exist?) | Necro | SageTV Studio | 3 | 10-18-2006 03:50 PM |
XMLTV Parsing Software... | pawn | SageTV EPG Service | 0 | 01-13-2004 03:00 PM |