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

On September 5, 2003 08:17 am, Pferdekaemper, Thorsten wrote:
> Hi,
> yesterday, I have installed the grabber from Ben Bucksch which uses the
> data sources of TV-Movie to create XMLTV files. At the end, it worked, but
> there are some findings I'd want to share.
>
> 1. The listings sometimes contain real unicode characters, i.e. characters
> with a number outside range(256). This causes freevo not to accept the
> listing. I then wrote an own function __encode in epg_xmltv.py which looks
> roughly like this:
>
> def __encode(str,code):
>       try:
>               return str.encode(code)
>       except UnicodeError:
>               result = ''
>               for ch in str:
>                       try:
>                               result = result + ch.encode(code)
>                       except UnicodeError:
>                               pass
>               return result
>
> Then, I have replaced every occurrence of encode in epg_xmltv.py with my
> own function. After that, it worked, ommitting the characters which seem
> not to be displayable by freevo.

That was unnecessary. From the Python library reference::

  encode([encoding[,errors]])
    Return an encoded version of the string. Default encoding is the current
    default string encoding. errors may be given to set a different error
    handling scheme. The default for errors is 'strict', meaning that encoding
    errors raise a ValueError. Other possible values are 'ignore' and
    'replace'. New in version 2.0.

Basically, to get the same behaviour as you created you can just use 'ignore' 
as the second argument to encode(). If you use 'replace', the character will 
be replaced with '?'. I'd suggest 'replace', but that's a personal 
preference.



> 2. The listings contain a <color> tag, which freevo does not know. There is

Freevo doesn't know that <color> tag because it's invalid. The author of the 
grabber needs to fix that. In fact, you should probably tell the author to 
validate the XML output against the XMLTV DTD. I highly recommend pyRXP due 
to it's amazing speed: http://www.reportlab.com/xml/pyrxp.html

To use pyRXP to validate, make sure the DTD is in the current directory and 
run this script on the file you want to validate:

- ---cut---
#!/usr/bin/env python
import sys, pyRXP

def handleMessage(s):
    sys.stderr.write(s+'\n')

if __name__ == '__main__':
    if len(sys.argv) < 2:
        sys.stdout.write("Must specify file")
        sys.exit(2)

    p = pyRXP.Parser()
    p.srcName = "XMLTV pyRXP"
    p.warnCB = handleMessage

    p.parse(open(sys.argv[1]).read())
- ---cut---


> 3. The listings contain a Tag like <rating system=FSK>16</rating>. It seems
> that freevo has a problem with that. I deleted the handling of this tag in
> epg_xmltv.py to make this work. (freevo does not seem to display the rating
> anyway.

Any code using rating for anything other than straight text display should be 
checking the system attribute.


> 4. The listings contain the time in the following format:
>       200309042015 CET
> But this is IMHO wrong, it should be
>       200309042015 CEST
> Then, the coding with strptime.strptime in epg_xmltv.py works correctly.
> This is not necessarily a problem of freevo, but I just wanted to mention.
> I have sent a mail to Ben Bucksch about that. I will also check how the
> listings could be converted to the CET/CEST format.

I highly recommend using numeric timezones in grabbers. Some of the grabbers 
from the official XMLTV distribution do this already and the others will be 
converted soon. Some of those strings are conflicting, such as my timezone, 
Canada/Atlantic, and Saudi Arabia's, both of which are 'AST'.


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

iD8DBQE/WVl/Ktn0F7+/lLMRAskIAJ9HJB8/9rGdyfKIC/UuYqc/ifO9wQCdHRRH
dYvrmj2t4iwE+BiD9BTz9VE=
=+Y6h
-----END PGP SIGNATURE-----



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to