2004-07-08, 16:31
for those in the uk - some dude has written a script to grab/translate/amalgamate bleb.org/tv listings.
pretty handy if you can't be arsed to get xmltv working.
pretty handy if you can't be arsed to get xmltv working.
Quote:03-09-2004 19:45:49 notice running the application...
03-09-2004 19:45:49 info -->python initialized<--
03-09-2004 19:45:49 info
03-09-2004 19:45:49 info get url: http://www.xbox-scene.com/xbox1data/xbox-scene.xml
03-09-2004 19:45:49 info detecting dvd-rom media filesystem...
03-09-2004 19:45:49 error detection of dvd-rom media failed.
03-09-2004 19:45:57 info sys:1: deprecationwarning: non-ascii character '\xc6' in file q:\scripts\tv.guide.py on line 253, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
03-09-2004 19:45:58 info html size failed:
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info exceptions.typeerror
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info int() argument must be a string or a number
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info traceback (most recent call last):
03-09-2004 19:45:58 info file "q:\scripts\tv.guide.py", line 89, in gethtmlsize
03-09-2004 19:45:58 info size = int(res.getheader("content-length"))
03-09-2004 19:45:58 info typeerror: int() argument must be a string or a number
03-09-2004 19:45:58 info getsize() failed:
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info exceptions.oserror
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info [errno 2] no such file or directory: 'q:\\tvguide\\listing.xml'
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info traceback (most recent call last):
03-09-2004 19:45:58 info file "q:\scripts\tv.guide.py", line 55, in downloadlist
03-09-2004 19:45:58 info file_size = getsize(listing)
03-09-2004 19:45:58 info file "q:\python\lib\ntpath.py", line 228, in getsize
03-09-2004 19:45:58 info oserror: [errno 2] no such file or directory: 'q:\\tvguide\\listing.xml'
03-09-2004 19:45:58 info no listing available
03-09-2004 19:45:58 info
03-09-2004 19:45:58 info []
03-09-2004 19:45:58 info
Quote:03-09-2004 19:52:04 info -->python initialized<--
03-09-2004 19:52:04 info
03-09-2004 19:52:04 info get url: http://www.xbox-scene.com/xbox1data/xbox-scene.xml
03-09-2004 19:52:04 info detecting dvd-rom media filesystem...
03-09-2004 19:52:04 error detection of dvd-rom media failed.
03-09-2004 19:52:14 info sys:1: deprecationwarning: non-ascii character '\xc6' in file q:\scripts\tv.guide.py on line 253, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
03-09-2004 19:52:14 info html size failed:
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info exceptions.typeerror
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info int() argument must be a string or a number
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info traceback (most recent call last):
03-09-2004 19:52:14 info file "q:\scripts\tv.guide.py", line 89, in gethtmlsize
03-09-2004 19:52:14 info size = int(res.getheader("content-length"))
03-09-2004 19:52:14 info typeerror: int() argument must be a string or a number
03-09-2004 19:52:14 info local size is:
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info 1019882
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info sizes differ: retrieving new listing...
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info download failed:
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info exceptions.nameerror
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info global name 'urllib' is not defined
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info traceback (most recent call last):
03-09-2004 19:52:14 info file "q:\scripts\tv.guide.py", line 67, in downloadlist
03-09-2004 19:52:14 info urllib.urlretrieve(url, filename)
03-09-2004 19:52:14 info nameerror: global name 'urllib' is not defined
03-09-2004 19:52:14 info traceback (most recent call last):
03-09-2004 19:52:14 info file "q:\scripts\tv.guide.py", line 590, in ?
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info tvguide = ctvguide()
03-09-2004 19:52:14 info file "q:\scripts\tv.guide.py", line 317, in
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info self.processxml.processxml()
03-09-2004 19:52:14 info file "q:\scripts\tv.guide.py", line 145, in processxml
03-09-2004 19:52:14 info
03-09-2004 19:52:14 info channels = split(listing, '<channel ')
03-09-2004 19:52:14 info file "q:\python\lib\string.py", line 121, in split
03-09-2004 19:52:14 info attributeerror
03-09-2004 19:52:14 info :
03-09-2004 19:52:14 info 'nonetype' object has no attribute 'split'
03-09-2004 19:52:14 info
Quote:# python xmltv "listing.xml" tvguide script by cruent 2004
# version update 0.2: added ftp support and sorted channels
# version update 0.3: added url support, init. dialog
import time, xbmcgui, xbmc
import sys, httplib, traceback
# seems we have to import urllib explicitly
import urllib
from urllib import urlretrieve
from re import search, dotall
from ftplib import ftp
from string import split, replace
from textwrap import fill
from os.path import getsize
from urlparse import urlparse
# want sorted channels