Hi,
        I would create TV.xml using tv_grab_nz, but I could never get anything to
show in the TV Guide. I have traced the problem to timestr2secs_utc(). The
start (and stop) time format in TV.xml is 'YYYYmmddHHMM', which
timestr2secs_utc was not expecting. I've rewritten this subroutine (Don't be
too harsh, its my first attempt at Python).

Andrew


# Part of: src/tv/epg_xmltv.py......

#
# Convert a timestring to UTC (=GMT) seconds.
#
# The format is either one of these three:
# '20020702100000 CDT'
# '200209080000 +0100'
# '200209080000'
def timestr2secs_utc(str):
    # This is either something like 'EDT', or '+1'
    str_items=str.split()
    if (len(str_items)==2):
        tval = str_items[0]
        tz = str_items[1]

        # Is it the '+1' format?
        if tz[0] == '+' or tz[0] == '-':
            tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]),
int(tval[8:10]), int(tval[10:12]), 0, -1, -1, -1 )
            secs = calendar.timegm( tmTuple )

            adj_neg = int(tz) >= 0
            adj_secs = int(tz[1:3])*3600+ int(tz[3:5])*60
            if adj_neg:
                secs -= adj_secs
            else:
                secs += adj_secs

    elif (len(str_items)==1):
        # No, use the regular conversion

        ## WARNING! BUG HERE!
        # The line below is incorrect; the strptime.strptime function
doesn't
        # handle time zones. There is no obvious function that does.
Therefore
        # this bug is left in for someone else to solve.

        # Without the +20 the TV Guide had a 1 minute error ie showed 17:59
instead of 18:00
        # Also I changed the date format to: xmltv.date_format_notz
        secs = time.mktime(strptime.strptime(str, xmltv.date_format_notz)) +
20

    else:
        raise EPG_TIME_EXC

    return secs




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Freevo-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to