-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On January 29, 2004 03:18 am, Oliver Welter wrote:
> Hi,
>
> I have a problem integrating xmltv listings into freevo...
>
> My /tmp/TV.xml looks like this...
>
>
>    <channel id="RTL.tvtoday.de">
>      <display-name>RTL</display-name>
>    </channel>
> .....
>    <programme start="20040127000000" stop="20040127003500"
> showview="77-640" channel="RTL.tvtoday.de">
>      <title lang="de">Nachtjournal </title>
>      <desc lang="de">Mit Susanne Kronzucker</desc>
>    </programme>

Freevo needs the timezones in the date fields::
  <programme start="20040127000000 -0100" stop="20040127003500 -0100" ...>


The real fix, though, is to observe ISO 8601 in src/tv/
epg_xmltv.py:timestr2secs_utc (my quick and crappy untested implementation):

len_fmt = { 4:  '%Y',
            6:  '%m',
            8:  '%d',
            10: '%H',
            12: '%M',
            14: '%S' }

def timestr2secs_utc(str):
    date_format = ""

    if len(str.split()) > 1:
        tz = str.split()[1]
    else:
        tz = None

    t = str.split()[0]
    slen = len(t)

    sorted_keys = len_fmt.keys()
    sorted_keys.sort()

    for k in sorted_keys:
        if slen <= k:
            date_format += len_fmt[k]

    if tz:
        date_format += " " + tz

    return time.mktime(strptime.strptime(str, date_format))



Even better, use datetime objects instead:

http://www.python.org/doc/current/lib/module-datetime.html


- -- 
James Oakley
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAH1KnKtn0F7+/lLMRAhpgAKCOwiuzVSTqP7JyN8bxWcACJtISvQCg0/1n
jrrtJG0RMmgCfX6BvfZfbtY=
=mDkA
-----END PGP SIGNATURE-----



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freevo-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to