PDA

View Full Version : Interactive TV-Guide (Python XMLTV)


cruent
2004-06-04, 13:42
hi all,

i made a nice interactive tvguide script and it can be found at the python script page (http://dwl.xboxmediacenter.de/) :)

feel free to modify it and optimize it :)

all you have to do is to download xmltv (http://sourceforge.net/projects/xmltv), configure it and update the listing.xml file

just wanna share my work with you all.

enjoy

cruent
2004-06-04, 21:41
how to update the listing.xml i made a little batch file, feel free to modify it to your needs and make it run in windows taskmanager every 2 days (be sure that your xbox is online) :)


@echo off
rem xml tv guide setup by cruent

:: xmltv setup
rem xmltv.exe tv_grab_dk --configure --config-file tv_grab_dk.conf

:: get tv informations
xmltv.exe tv_grab_dk --config-file tv_grab_dk.conf --output listing.xml --days 2

:: upload tv informations to the xbox

> script.ftp echo xbox
>>script.ftp echo xbox
>>script.ftp echo cd /f
>>script.ftp echo cd /f:
>>script.ftp echo cd apps\xbmc\tvguide
>>script.ftp echo binary
>>script.ftp echo prompt n
>>script.ftp echo put listing.xml
>>script.ftp echo bye
:: use the temporary script for unattended ftp
ftp -v -s:script.ftp 192.168.0.2
:: for the paranoid: overwrite the temporary file before deleting it
type nul >script.ftp
del script.ftp

echo enjoy!


thats all for now :)

ktd
2004-06-06, 20:30
nice one!

is it possible to sort channel list?
i want them to show up in the order i have them in my listings.xml...

ent
2004-06-07, 11:38
it's nice but i prefer to wait till it's more usable... right now it's too difficult.. too much work to make it work..
its not going to get any easier. do you expect it to get the tv guide data for you?

anyhow this is a great script, worked fine with my australian tv guide data.

Gamester17
2004-06-07, 17:12
listing.xml grabbers for new zealand and belgium/holland written in python so might work in xbmc for cruent's xmltv tv guide script:
http://sourceforge.net/projects/pytvgrab/ * ...i only wish there where more grabber scripts like those available (i'm in the uk myself)

cruent
2004-06-08, 18:03
nice one!

is it possible to sort channel list?
i want them to show up in the order i have them in my listings.xml...
hehe its kind of difficult, because a dictonary list is stored randomly :nuts:

you can do like this:


# the channel number
self.channum = 0
self.sortedchanlist = chanlist.values()
# self.sortedchanlist.sort()

like this the channels are not sorted and stored as a normal dictonary list (randomly) :p

when i get more time i'll look into this :)

cheers

ktd
2004-06-08, 18:21
i´v done that already but its still not i the order as i have the channels in my listings.xml...

looking forward to see if you can/will sort it out when you have the time...

*edit*
maybee if "we" hard code the order the channel nummbers should list?
i know its an ugly solution but its just a one time job (and if you add remove some channels)...

ktd
2004-06-09, 00:45
just made a python script that copy listing.xml from my server to xbox everytime xbmc start...

and since i made a schedule that grabs a new 2 days listing.xml that runs every day at 10 am i have a fully automatic tvguide!

thanks alot for the tvguide script cruent!!!

Chrack
2004-06-09, 17:14
very nice python script.
i have a problem and hope someone can help me ;-)
my prob. is, that i can´t create the tv guide for german programms. i found these xmltv channel ids but they don´t work.
# xmltv channel ids for tv_grab_de_tvtoday, and the channel id on the
# site they map to.
#
3sat.de:3sat
ard.de:ard
arte-tv.com:arte
cnn.com:cnn
dsf.com:dsf
eurosport.de:eurosport
hr-online.de:hessen
hamburg1.de:hamburg%201
kabel1.de:kabel%201
kika.de:kinder%20kanal
mdr.de:mdr
mtv.de:mtv
mtv2.de:mtv2
n-tv.de:n-tv
n24.de:n24
ndr.de:ndr
neunlive.de:neunlive
1.omroep.nl:holland%201
2.omroep.nl:holland%202
3.omroep.nl:holland%203
orb.de:orb
1.orf.at:orf%201
2.orf.at:orf%202
phoenix.de:phoenix
prosieben.de:pro%207
rtl.de:rtl
rtl2.de:rtl%202
superrtl.de:super%20rtl
sat1.de:sat.1
1.sfdrs.ch:sf1
2.sfdrs.ch:sf2
swr.de:sw%20iii
tvb.de:tv%20berlin
viva.tv:viva
vox.de:vox
wdr.de:west
zdf.de:zdf
tf1.fr:tf%201
trt.net.tr:trt
nbc.com:nbc-super
euronews.net:euronews
france3.fr:fr%203
tvnrw.de:tvnrw
vivaplus.tv:vivaplus
3.br-online.de:bayern
bbcworld.com:bbcworld
tv5.org:tv5
france2.fr:antenne%202
sfb.de:sfb1
xxp.tv:xxp
tvm.de:tv%20m%dcnchen
premiere.de:premiere
tele5.de:tele5

can someone help me by these channels to put it in the listing.xml??

sorry for my english, it´s not the best :rolleyes:

ktd
2004-06-09, 17:24
you cant just put a few channels in a file called listing.xml. you have to grab (create) a file called listing.xml that you put in the tvguid folder on you xbox...

here, http://sourceforge.net/project/showfiles.php?group_id=39046 is a good place to start...

cruent
2004-06-09, 18:56
i just updated the tv-guide to version 0.2 and it can be found on the python script page (http://dwl.xboxmediacenter.de/)

now you can sort the channels or not.

it support ftp, so the guide checks if the listing.xml filesize is different on the xbox and if the updated file is there it does nothing.

this means that you have to install a ftp server on your workstation which updates the listing.xml file (located in the root of the ftp) every 2. day.
modify the script to your ip/port/user/pass

and you only need this now:

:: get tv informations
xmltv.exe tv_grab_dk --config-file tv_grab_dk.conf --output listing.xml --days 2

and then the guide will upload listing.xml on executing the script only if needed :)

cheers

/cruent

ktd
2004-06-09, 20:16
great work with the (not)sorting of channels!

i couldnt get along with your ftp script thing but thats ok because i did my own last night that grabs listing.xml via ftp from my server everytime i start xbmc...

one thing you should add in your ftp section is the path to lisitng.xml if its not in the root of your ftp server and you dont wanna add a user only for this...
i did add that in your script before i switched back to my script again...

Urk977
2004-06-17, 22:21
just uploaded version 0.3 of the script :p it adds support to download the listing using an url.

when (if ???) the admin dude approves it you will find it on the python scripts page http://dwl.xboxmediacenter.de

cheers,

urk977

nianhbg
2004-06-18, 11:42
this is a great script. :lol: thanks

i´m still working on a swedish script with channels icons
and a diffrent channel display.

/nianhbg

senergy
2004-06-27, 19:28
i just discovered a australian xmltv grabber so i finally got to test this script out. its great. needs a liitle prettying up with icons etc but im really excited with it.
thanks a lot dude.

ktd
2004-06-28, 12:26
just uploaded version 0.3 of the script *:p *it adds support to download the listing using an url.

when (if ???) the admin dude approves it you will find it on the python scripts page http://dwl.xboxmediacenter.de

cheers,

urk977
seams like they dont wanna put it up there. could you put it someware else?

*edit*
just saw that they have put it on the web page but under python and not where alla other scripts are...

Prican25
2004-06-30, 07:35
hi, i thought i'd give this a try but all it get is the script saying please wait (waited 20mins) :sniffle:

i grabbed tv-guide_v0.2 and tv.guide 0.3 to replace the old py file in tv-guide_v0.2. i added the tv gudie folder and the script files as it said in the readme and then made the listing.xml using the latest xmltv.

senergy
2004-06-30, 18:57
hi,
im having some troubles with the ftp option.
ive modded the script for my user/pass/ip and i can see the xbox login successfully to my ftp server but it fails to pull down the file.
in the log file i get "failed to ftp listing.xml"
but "listing.xml" is def in the root directory of the ftp server.

Urk977
2004-07-03, 11:50
hi, i thought i'd give this a try but all it get is the script saying please wait (waited 20mins) :sniffle:
is your xbox network connection working? did you try to get your listing.xml file using the url you use in the script from a pc web browser (connected to the same network)?
what's xbmc.log saying? should be something like:

03-07-2004 10:42:15 -->python initialized<--
03-07-2004 10:42:15
03-07-2004 10:42:15 sys:1: deprecationwarning: non-ascii character '\xc6' in file q:\scripts\tv.guide.py on line 252, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
03-07-2004 10:42:15 server size is:
03-07-2004 10:42:15
03-07-2004 10:42:15 222480
03-07-2004 10:42:15
03-07-2004 10:42:15 local size is:
03-07-2004 10:42:15
03-07-2004 10:42:15 237611
03-07-2004 10:42:15
03-07-2004 10:42:15 sizes differ: retrieving new listing...

the listing used in this example (237kb) takes about 2 seconds to load on my xbox.

Urk977
2004-07-03, 11:57
im having some troubles with the ftp option.
ive modded the script for my user/pass/ip and i can see the xbox login successfully to my ftp server but it fails to pull down the file.
in the log file i get "failed to ftp listing.xml"
but "listing.xml" is def in the root directory of the ftp server.
you get that error when either the login fails or the actual retrieval of the file fails. try to test it with an ftp client using the same u/p as configured on the xbox. try to increase the ftp server log level and look for a reason the download fails.

hurtz
2004-07-04, 19:12
the listing used in this example (237kb) takes about 2 seconds to load on my xbox.
237kb? how'd you manage that? mine's 2,319kb - and thats only 2 days worth of listings. is it just that i have a lot of channels - or am i downloading too many details that can be stripped out?

i run a scheduled task each night @ 1am that does:

c:\xmltv\xmltv.exe tv_grab_na_dd --days 2 --output c:\inetpub\wwwroot\xmltv\listing.xml

hurtz

Urk977
2004-07-04, 19:47
237kb? how'd you manage that? mine's 2,319kb - and thats only 2 days worth of listings. is it just that i have a lot of channels - or am i downloading too many details that can be stripped out?
i use 18 channels (removed everything i don't need listings for) and generate for 1 day only. i collect the listing on my 24/7 linux firewall machine with this script:
#!/bin/bash
#set -x

xmltvdir=/home3/xmltv
listdir=listing
quiet="--quiet"

# run everything form here
cd $xmltvdir

# get new listing and enrich it with imdb data
tv_grab_nl $quiet --slow --days 1 | tv_imdb --imdbdir $xmltvdir/imdb $quiet > $listdir/listing.xml.work

# save old stuff
mv -f $listdir/listing.xml $listdir/listing.xml.yesterday

# place new one
mv -f $listdir/listing.xml.work $listdir/listing.xml

runs every night from cron. generating this listing file already takes about 20 minutes on my (slow) machine.

Prican25
2004-07-05, 10:42
urk977 well what i did was just use the latest xmltv and build the listing.xml and then transfer it to xbmc's tv guide folder.

my network connection is fine (tested it with kml browser and others) but you have me confused about getting my listing.xml file using the url you use in the script from a pc web browser.

and last heres what my log says when i try the script:
05-07-2004 03:12:27 -->python initialized<--
05-07-2004 03:12:27
05-07-2004 03:12:27 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
05-07-2004 03:12:28 html size failed:
05-07-2004 03:12:28
05-07-2004 03:12:28 socket.error
05-07-2004 03:12:28
05-07-2004 03:12:28 (10061, 'connection refused')
05-07-2004 03:12:28
05-07-2004 03:12:28 traceback (most recent call last):
05-07-2004 03:12:28 file "q:\scripts\tv.guide.py", line 87, in gethtmlsize
05-07-2004 03:12:28 h.request('head', p[2])
05-07-2004 03:12:28 file "q:\python\python23.zlib\httplib.py", line 718, in request
05-07-2004 03:12:28 file "q:\python\python23.zlib\httplib.py", line 740, in _send_request
05-07-2004 03:12:28 file "q:\python\python23.zlib\httplib.py", line 712, in endheaders
05-07-2004 03:12:28 file "q:\python\python23.zlib\httplib.py", line 597, in _send_output
05-07-2004 03:12:28 file "q:\python\python23.zlib\httplib.py", line 564, in send
05-07-2004 03:12:28 file "q:\python\python23.zlib\httplib.py", line 548, in connect
05-07-2004 03:12:28 error: (10061, 'connection refused')
05-07-2004 03:12:28 local size is:
05-07-2004 03:12:28
05-07-2004 03:12:28 14560847
05-07-2004 03:12:28
05-07-2004 03:12:28 sizes differ: retrieving new listing...
05-07-2004 03:12:28
05-07-2004 03:12:28 download failed:
05-07-2004 03:12:28
05-07-2004 03:12:28 exceptions.nameerror
05-07-2004 03:12:28
05-07-2004 03:12:28 global name 'urllib' is not defined
05-07-2004 03:12:28
05-07-2004 03:12:28 traceback (most recent call last):
05-07-2004 03:12:28 file "q:\scripts\tv.guide.py", line 67, in downloadlist
05-07-2004 03:12:28 urllib.urlretrieve(url, filename)
05-07-2004 03:12:28 nameerror: global name 'urllib' is not defined
05-07-2004 03:12:28 traceback (most recent call last):
05-07-2004 03:12:28 file "q:\scripts\tv.guide.py", line 590, in ?
05-07-2004 03:12:28
05-07-2004 03:12:28 tvguide = ctvguide()
05-07-2004 03:12:28 file "q:\scripts\tv.guide.py", line 317, in
05-07-2004 03:12:28
05-07-2004 03:12:28 self.processxml.processxml()
05-07-2004 03:12:28 file "q:\scripts\tv.guide.py", line 145, in processxml
05-07-2004 03:12:28
05-07-2004 03:12:28 channels = split(listing, '<channel ')
05-07-2004 03:12:28 file "q:\python\python23.zlib\string.py", line 121, in split
05-07-2004 03:12:28 attributeerror
05-07-2004 03:12:28 :
05-07-2004 03:12:28 'nonetype' object has no attribute 'split'
05-07-2004 03:12:28

Urk977
2004-07-05, 21:38
my network connection is fine (tested it with kml browser and others) but you have me confused about getting my listing.xml file using the url you use in the script from a pc web browser.

well, the idea is that you get the listing.xml from another machine automatically when you start the tvguide script. this machine should run a ftp server or a web server. let's focus on a web server (that's why i wrote the patch). so what you need to do is to put the listing.xml somewhere on a webserver so you can point to it with an url. where exactly you have to put the file depends on the type of webserver and the configuration used. most convenient way is to generate the listing.xml on a machine which runs a webserver. that way you can set things up so you don't need to do anything manually and always have the newest listing.

the most easy way to test if your url is correct is to test it with a web browser. for example, the url i use is http://192.168.0.1:8080/xmltv/listing.xml this means my webserver is running on a machine with ip address 192.168.0.1 on port 8080 (default would be 80) and listing.xml is in a directory called xmltv. when i type this url into a web browser and press enter i see the listing.xml file. that's what i meant with using the url in a pc web browser.

05-07-2004 03:12:27 -->python initialized<--
05-07-2004 03:12:27
05-07-2004 03:12:27 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
05-07-2004 03:12:28 html size failed:
05-07-2004 03:12:28
05-07-2004 03:12:28 socket.error
05-07-2004 03:12:28
05-07-2004 03:12:28 (10061, 'connection refused')
oops, connection refused. nobody's listening at the address you put in the script :) what url did you put in the script?

the rest of the errors look like a result of the first one, don't worry about them (i should write a better error handler :lol: ).

from your post i get the impression you put a listing.xml on the xbox and try to point the url to that file. that's not how it works. the tvguide script will download the listing.xml from another machine when started.

hope this helps, contact me if you need more help.

.

Prican25
2004-07-05, 22:16
so you're basically telling me that i can't just use the listing.xml thats in the xbox ???

i'm n00b at this thing about making a webserver so i'll look that up but in case that doesn't work for me how about ftp server? when i tried changing the http info to my ftp (xml:tv@192.168.1.2) but it gave me errors.

update: ok i got the webserver running and added the info in the py file but now i get this error in the log:
05-07-2004 15:39:36 -->python initialized<--
05-07-2004 15:39:36
05-07-2004 15:39:36 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
05-07-2004 15:39:37 server size is:
05-07-2004 15:39:37
05-07-2004 15:39:37 14579906
05-07-2004 15:39:37
05-07-2004 15:39:37 local size is:
05-07-2004 15:39:37
05-07-2004 15:39:37 14560847
05-07-2004 15:39:37
05-07-2004 15:39:37 sizes differ: retrieving new listing...
05-07-2004 15:39:37
05-07-2004 15:39:37 download failed:
05-07-2004 15:39:37
05-07-2004 15:39:37 exceptions.nameerror
05-07-2004 15:39:37
05-07-2004 15:39:37 global name 'urllib' is not defined
05-07-2004 15:39:37
05-07-2004 15:39:37 traceback (most recent call last):
05-07-2004 15:39:37 file "q:\scripts\tv.guide.py", line 67, in downloadlist
05-07-2004 15:39:37 urllib.urlretrieve(url, filename)
05-07-2004 15:39:37 nameerror: global name 'urllib' is not defined
05-07-2004 15:39:37 traceback (most recent call last):
05-07-2004 15:39:37 file "q:\scripts\tv.guide.py", line 590, in ?
05-07-2004 15:39:37
05-07-2004 15:39:37 tvguide = ctvguide()
05-07-2004 15:39:37 file "q:\scripts\tv.guide.py", line 317, in
05-07-2004 15:39:37
05-07-2004 15:39:37 self.processxml.processxml()
05-07-2004 15:39:37 file "q:\scripts\tv.guide.py", line 145, in processxml
05-07-2004 15:39:37
05-07-2004 15:39:37 channels = split(listing, '<channel ')
05-07-2004 15:39:37 file "q:\python\python23.zlib\string.py", line 121, in split
05-07-2004 15:39:37 attributeerror
05-07-2004 15:39:37 :
05-07-2004 15:39:37 'nonetype' object has no attribute 'split'
05-07-2004 15:39:37

Urk977
2004-07-05, 23:04
so you're basically telling me that i can't just use the listing.xml thats in the xbox ???

i'm n00b at this thing about making a webserver so i'll look that up but in case that doesn't work for me how about ftp server? when i tried changing the http info to my ftp (xml:tv@192.168.1.2)but it gave me errors
the tvguide script was written so you don't have to copy the listing.xml file to you xbox everytime. it downloads a new listing when you run it.

this is how it works step by step:

1. generate listing.xml file.
2. copy listing in web (or ftp) directory
3. point tvguide script url to listing.xml on web (or ftp) server
4. run tvguide
5. script will compare the size of listing.xml with a cached copy
6. if size is different (listing changed) download listing to cache
7. if size is the same: don't download
8. use listing.xml (from cache) to display tv guide

steps 1,2,3 can be automated so you don't need to do anything but run tvguide!

and to answer your second question, i've put ftp between brackets 'cause i did not test it. an ftp url looks something like: ftp://xml:tv@192.168.1.2/listing.xml (user xml with password tv) .

if the ftp url download doesn't work you can try the original ftp code. to enable that in version 0.3 move to line 141 and remove the #, put a new # in front of line 142. don't forget to enter your ftp info on lines 98 to 101.

ps. i saw that your listing.xml was very large, if you get weird errors (apart from the web/ftp problem) i suggest you test it with a smaller listing (1 day listing or so).

Urk977
2004-07-05, 23:10
update: ok i got the webserver running and added the info in the py file but now i get this error in the log:

05-07-2004 15:39:37 14579906
05-07-2004 15:39:37
05-07-2004 15:39:37 local size is:
05-07-2004 15:39:37
05-07-2004 15:39:37 14560847
05-07-2004 15:39:37
05-07-2004 15:39:37 sizes differ: retrieving new listing...
05-07-2004 15:39:37
05-07-2004 15:39:37 download failed:
05-07-2004 15:39:37
05-07-2004 15:39:37 exceptions.nameerror
05-07-2004 15:39:37
05-07-2004 15:39:37 global name 'urllib' is not defined
05-07-2004 15:39:37
05-07-2004 15:39:37 traceback (most recent call last):
05-07-2004 15:39:37 file "q:\scripts\tv.guide.py", line 67, in downloadlist
05-07-2004 15:39:37 urllib.urlretrieve(url, filename)
05-07-2004 15:39:37 nameerror: global name 'urllib' is not defined
:nuts: weird error, try rebooting your xbox (seen python behave strange after some errors) and also test with a smaller file.

Prican25
2004-07-06, 00:17
well i cut off a bunch of useless channels to make the file shorter (9.20mb) and reseted the xbox but still gives me the same error :sniffle:

Urk977
2004-07-06, 22:44
well i cut off a bunch of useless channels to make the file shorter (9.20mb) and reseted the xbox but still gives me the same error :sniffle:
ok, i tested with large files, 9 to 10mb should be ok (but very slow). i get memory errors on a 16mb file. my listing for 18 dutch channels, 1 day, is only 250kb!

i really do not understand why you have these errors. i've seen errors like it when developing and testing the script but those went away after rebooting the xbox.

i wrote a small test script to see if there's something wrong with your environment. copy/paste it from this post (see below) and put it in a file, for example test.py.

before uploading it to the xbox script dir, edit it and put the correct url in. copy it to your xbox and run it. you should see [running] for a short period on the screen. the script downloads the listing.xml to the tvguide directory. look in xbmc.log for errors.

import sys, traceback
from urllib import urlretrieve

filename = "q:\\tvguide\\listing.xml"
url = "http://192.168.0.1:8080/xmltv/listing.xml"

print "testurllib: retrieving " + url

try:
urllib.urlretrieve(url, filename)
except:
print "download failed: ", sys.exc_info()[0], sys.exc_info()[1]
traceback.print_exc(file=sys.stdout)

print "done"

bitplane
2004-07-08, 15:17
uk users-
bleb.org (http://www.bleb.org/tv/) have xml tv listings, i haven't tried it out yet but thought i should mention it anyway

jobbie
2004-07-08, 17:31
for those in the uk - some dude has written a script to grab/translate/amalgamate (http://homepage.ntlworld.com/zmower/tv_grab_uk_bleb.html) bleb.org/tv listings.
pretty handy if you can't be arsed to get xmltv working.

flautash
2004-07-13, 13:19
has anyone here tried o2grabber from
http://www.o2design.se/o2grabber/ ?

ktd
2004-07-13, 13:26
i use it everyday...

do you know swedish? iv written a guide for auto update listing.xml everyday from a ftp or http server...

http://forum.psxcare.com/support/showthread.php?t=14885

i will update it with my http script later today. right now it only update listing.xml via ftp...

i did this cus i couldnt get the update thing in tvguide.py to work...
my script dosent check the filesize, i use the date of the file and if its older then today and after 10am (when mt listing.xml gets updated on my server) i copy it to my xbox when xbmc starts...

Izzo
2004-07-13, 22:14
hi all,

i'm having some problems with the script, its not downloading the listing.xml at all, xbmc.log shows the following error :

13-07-2004 21:05:54 -->python initialized<--

13-07-2004 21:05:54

13-07-2004 21:05:54 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

13-07-2004 21:05:54 html size failed:

13-07-2004 21:05:54

13-07-2004 21:05:54 exceptions.typeerror

13-07-2004 21:05:54

13-07-2004 21:05:54 int() argument must be a string or a number

13-07-2004 21:05:54

13-07-2004 21:05:54 traceback (most recent call last):

13-07-2004 21:05:54 file "q:\scripts\tv.guide.py", line 89, in gethtmlsize

13-07-2004 21:05:55 size = int(res.getheader("content-length"))

13-07-2004 21:05:55 typeerror: int() argument must be a string or a number

13-07-2004 21:05:55 getsize() failed:

13-07-2004 21:05:55

13-07-2004 21:05:55 exceptions.oserror

13-07-2004 21:05:55

13-07-2004 21:05:55 [errno 2] no such file or directory: 'q:\\tvguide\\listing.xml'

13-07-2004 21:05:55

13-07-2004 21:05:55 traceback (most recent call last):

13-07-2004 21:05:55 file "q:\scripts\tv.guide.py", line 55, in downloadlist

13-07-2004 21:05:55 file_size = getsize(listing)

13-07-2004 21:05:55 file "q:\python\lib\ntpath.py", line 228, in getsize

13-07-2004 21:05:55 oserror: [errno 2] no such file or directory: 'q:\\tvguide\\listing.xml'

13-07-2004 21:05:55 no listing available

professorB
2004-08-22, 20:47
great script; i've added it to my front page and use it lots.

the sort function doesn't play nice with channel numbers 1-9; my list starts with 10 and 2 comes before 20, etc. is there a way to edit the parsing so that they have front zeros and hence come before channel 10?

also it'd be faboo if we could get it so that the was a selected box that would move around (to get info more easily). then again, i'm not sure it's necessary since its not too hard to move the box you want to the upper left corner.

:thumbsup:

i'm working on prettifying the pngs; will upload them if i get anywhere.

Striker
2004-08-26, 20:17
i just cant get it to work with 0820 cvs.
aqtbrowsers works fine, but this script just doesnt want to start. the code from urk977 to test the download does work :(
but downloading doesnt work ok with this script.

try http://194.109.6.92/~catwesel/tvguide/listing.xml

it just hangs on please wait....

Caracarn
2004-08-28, 05:24
anyone with a working grabber for australian tv guides, could you please provide the scripts etc?

Caracarn
2004-08-28, 06:11
found an australian xml tv grabber.

the script references png files in the tvguide dir, but i dont have them, where can i get these files

the path to images
background = "q:\\tvguide\\background.png"
timebar = "q:\\tvguide\\timebar.png"
blackbar = "q:\\tvguide\\blackbar.png"
titlebox = "q:\\tvguide\\titlebox.png"
descbox = "q:\\tvguide\\descbox.png"

Caracarn
2004-08-28, 12:24
i have generated an xml file, here is a sample of the file:

<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>
- <tv generator-info-name="auxmltvgrabber/1.0">
- <channel id="free.perth.10">
<display-name lang="en">network ten</display-name>
<icon src="http://d1.com.au/icons/10.png" />
</channel>
- <programme channel="free.perth.10" start="20040828020000 +1000" stop="20040828040000 +1000">
<title>home shopping</title>
<desc>(g)</desc>
<category>shopping</category>
<rating system="aba">g</rating>
</programme>


i run the tvguide python script in xbmc and everything seems to work ok, but i just get a blank screen with times along the top, but no tv guide info. is the xml file contain correct information or am i missing something?

smouge
2004-09-03, 20:50
i'm getting the following error:

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


it seems that if no listing.xml is available in q:\\tvguide it cannot compare and stops. would be better that in this case the script would just get the file from the url

smouge
2004-09-03, 20:55
but if i put a listing.xml file in that directory, it hangs with the message pleas wait. after rebooting the log shows the following:


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


looks like still something is wrong, looks like it cannnot find urllib ???

smouge
2004-09-04, 16:01
fixed, working now.

the problem was an incorrect ip addres for the url :(.

corrected the ip address where to get the listing.xml and works now like a charm.

nevertheless, an improved error handling would be nice (if you have time to do this)

smouge
2004-09-04, 16:38
sorry, cheering to soon.

the above error was not the real error.

the reason it was working was because i had run aqtbrowser before trying tv.guide. and guss what.. aqtbrowser also uses urllib. so it ssems if you run aqtbrowser first, it loads correctly the urllib. if after that you load tv.guide, it will run successfully.

however if you run tv.guide as the first thing after rebooting, tv-guide doesn't run.

i added the line import urllib to the tv.guide.py and now it runs perfectly, alss if you run it as the first script. seems that explicit loading of urllib is necessary???

modify tc.guide. py to make it loook like this:

# 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




hope this has been of use to some of you

DanX
2004-09-04, 19:41
i always get a blank screen and this in my log-file of the xbmx:

sys:1: deprecationwarning: non-ascii character '\xc6' in file q:\scripts\tv.guide.py on line 256, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
failed to ftp listing.xml
failed to open listing.xml


i can open the listing.xml with my web browser (ftp-server installed) but somehow xbmc can't transfer it :(

commio
2004-10-13, 13:36
ktd: would u please be able to post ur script when u enter xbmc is auto tranfers the listing.xml to ur xbox via ftp? all this ftp via the script does not work and is way to confusing.

do u need to download perl or something to use xmltv? where abouts is an australian grabber ??

commio
2004-10-13, 18:34
ktd: dont worry i found it thanks.

jj5768
2004-10-14, 23:40
does anyone use digiguide ? - i noticed on their beta site that version 8.1 now offers a web interface... just wondering if this could be used as a source of data instead of xmltv ??

mvoosten
2004-10-15, 20:29
does anyone use digiguide ? - i noticed on their beta site that version 8.1 now offers a web interface... just wondering if this could be used as a source of data instead of xmltv ??
same question for vodio (www.vodio.com)... use it to record tv programs and watch it through xbmc through windows share. however would love to see xbmc integration through their site.. i guess python would be the key here..
they also have a web interface and a web program guide.

Strawp
2004-11-08, 23:32
i miss the tv guide from xbmp (but not enough to go back and use it again :p ). i've had a little search around on here and noticed a few threads of python scripts to do with tv listings, but wasn't too sure about what they did.

i just want the same functionality as the old xbmp listings guide had - that is it picks up an existing xmltv file and parses it into a nice format.

i already have a schedule running on a server in the house that gets the tv listings, i just need to be able to view them.

which script do i need to download?

san
2004-11-09, 11:32
i haven't used this one myself but it looks like that it fits you needs. get the script from: http://www.based.com/xmltvdaemon/

i dislike the fact that you need a seperate scipt on you server to fetch the xml file. would be nice if the script itself could do that. anyway the one stated above is proberbly what your looking for.

if you need an alternative check:
http://dwl.xboxmediacenter.de/

Nickman
2004-11-09, 13:38
i haven't used this one myself but it looks like that it fits you needs. get the script from: http://www.based.com/xmltvdaemon/

i dislike the fact that you need a seperate scipt on you server to fetch the xml file. would be nice if the script itself could do that. anyway the one stated above is proberbly what your looking for.

if you need an alternative check:
http://dwl.xboxmediacenter.de/
my guess is that it's this script he is looking for.

interactive tv-guide using listing.xml v0.3 (http://dwl.xboxmediacenter.de/redirect.php?dlid=44&phpsessid=6bcd0e56aefd999564c840b128812783)

Strawp
2004-11-14, 19:21
thanks guys, i shall give this a try

pedropolis
2004-11-14, 19:46
the reason it was working was because i had run aqtbrowser before trying tv.guide. and guss what.. aqtbrowser also uses urllib. so it ssems if you run aqtbrowser first, it loads correctly the urllib. if after that you load tv.guide, it will run successfully.

however if you run tv.guide as the first thing after rebooting, tv-guide doesn't run.
i found the same thing happening to me, your code change worked a treat! :bowdown:

now its working, i think i have found a bug.
when viewing the listing scrolling to the side to view ahead or back again, if i scroll too fast the listings dissapear and im left with the background, times at the top and the channel names.
however it seems to just be a glitch in the display because when i press a i still get the program details for whatever is (meant be displayed) in that position.

has anyone else found this to be a problem?

i am using xmltv to produce my listings for at least a week at a time but i have since tried with smaller 2 day files (139k, uk terestrial channels a nd a few radio stations) and the same still happens

this is a great script, although it seems to download the listings every time eventhough the server copy and the one on the xbox are the same (can't read the file size from the web server it seems) but using the smaller file as above this only takes 10 seconds now :thumbsup:
with a weeks listing it was taking about a minute

i hope that this post makes sense to somebody

cheers

pete

elliots
2004-11-20, 03:30
hey. if anyone cares i found a php xmltv grabber for australian tv. it works really well, and if anyone wants i will run it on my server so everyone has updated aussie tv listings. (it grabs from yahoo)

http://magnetikonline.com/phpxmltv/

problem is, i cannot seem to get this python script to work with the output. i'm probably doing something wrong but if there is an error i dont mind debugging it myself (it will give me a good intro to python).

i cant seem to work out how to get access to the console text output on the xbox. sorry if this has been answered a million times but i couldnt find it.

any help would be appreciated.

elliot

kaisersose
2004-11-27, 14:25
@pedropolis

where abouts are you getting the listing.xml for uk channels? any info would be appreciated

ascl
2004-12-10, 01:39
hmmm, this script seems to get stuck on 'sorting' the listing... even
tho i have sorting disabled? anybody else see this?

i haven't had a chance to debug it yet, but after a brief look i can't even find the message dialog it gets stuck on in the source :-(

Livin
2004-12-10, 02:54
anyone planning on writing an english how-to guide on this?

Peteo
2005-01-29, 11:26
i cant seem to get this script to work. i have manualy put a listing.xml on the xbox that i created with xmltv. i do not have a web server or ftp running on my pc.

when i run the script it just hangs at please wait. is there any way to tell it not to use web/ftp?

i do have smb shares. is there any way to get this script to read the listing.xml from a smb share?

thanks

me.mod
2005-01-29, 19:29
for all the german people here:
(now in german..)
ich habe ein python script fürs xbmc geschrieben, dass das tv-programm von jetzt, heute und morgen anzeigen kann. dazu ist bei fast jeder sendung noch eine info mit a aufrufbar. es hat zurzeit 25 sender.
holt es euch auf www.xbmc.de (http://www.xbmc.de) !
viel spass,
me.mod

bitblaster
2005-01-30, 03:01
nice script.

just wish that there was a mythtv clone for windows (i know of mediaportal - i mean one that works with xbmc)
then i would have ultimate control over my xbox and entertainment.

mugsy3117
2005-01-30, 09:49
since tv.guide 0.3 is the only download on the python scripts page, are there files in 0.1 or 0.2 that i need? looking through the code i see there are picture files but i do not have them of course. if anyone could lead me to a place to download these files it would be greatly appreciated.

luciano
2005-03-07, 11:45
hi all,

i'm very interested in the tv-guide possibilities and read this thread. i can't seem to find the script though; the download page at dwl.xboxmediacenter.de doesn't seem to work (maybe due to the outage of the site in febrary). am i the only one experiencing this problem or could someone tell me where else i can get the python script mentioned...?

thanks in advance, luciano.

Tomkun
2005-03-07, 12:42
i am trying to grab the listings for japan with the xmltv program from sourceforge. it says that japan is not currently supported in the build, but is in the source. anyone know how i complie the latest version from source? i have looked at the sourceforge site, but i can't figure it out.

WarriorSan
2005-04-05, 23:21
hi all,

i'm very interested in the tv-guide possibilities and read this thread. i can't seem to find the script though; the download page at dwl.xboxmediacenter.de doesn't seem to work (maybe due to the outage of the site in febrary). am i the only one experiencing this problem or could someone tell me where else i can get the python script mentioned...?

thanks in advance, luciano.
i'm having the same problem since the old python page is down and xbmcscripts.com doesn't have the script yet...

can somebody provide us with a working link for this script? thnx

Urk977
2005-04-24, 23:18
back after a long time.... hi!

anyone still interested in that old tvguid 0.3 script? dunno what happened to the script download site, for some reason it's not there anymore. i should be able to find it on my hd.

nianhbg
2005-04-26, 17:19
i think there is a download on a swedish site called psxcare (http://www.psxcare.com).

i'm trying to get this script working under hd 720p i should be ready with this in a week or two

cruent
2005-04-26, 21:10
hello again,

nice to see some still giving this script a try.

sad they removed the script section :/

cheers

cruent
2005-05-05, 00:12
**update**

i just released a v0.4 of the script and i've written a little howto/tutorial to it also.

the script can be found at http://www.xbmcscripts.com
home / xbmc scripts / tv-guides (waiting for the admin to approve it...)

# version update 0.2: added ftp support and sorted channels
# version update 0.3: added url support and init. dialog
# version update 0.4: added how-to + hints, timeline, selected item, changed to pm3 skin and some bugfixes/improvements

feel free to modify and optimize it :-)

cheers and enjoy

/cruent

WarriorSan
2005-05-05, 17:53
thanks for the updates!

Livin
2005-05-05, 20:16
cruent,
i'm just installed this and i must thank you... i've been waiting for this for a while!!!

a few comments and suggestions...

1) can you add smb share support so that we can specify a share where the listings.xml file will be and the script will just use it from that location, or auto-copy (cache) the file locally during each invocation of the script?
it would be easier for those that do not have a web/ftp server.

2) can you make the .py so it can reside within the 'tvguide' folder. this keeps the scripts fodler cleaner and easier to manage.

3) the white line for marking the current time is a bit odd. not sure what a good way to do it would be but the line is "out of place" from a look n' feel standpoint.

4) can you consider color coding the guide itself? a person in the homeseer forums built a script based on xmltv and used color coding of the programs guide... it made things easier to view and very nice looking to!
here's the pic showing this:


thanks again!!!http://members.cox.net/affini/netremote/nr_tvguide.jpg

nianhbg
2005-05-06, 14:26
nice to see an update on this script. i can't wait to come home and test it :)

Mulefire
2005-05-07, 02:14
a quick and dirty hack to make it sort channel listings correctly is to replace the line:

self.sortedchanlist.sort()

with:

self.sortedchanlist.sort(lambda x, y: cmp('%020s' % x.split()[0], '%020s' % y.split()[0]))

this basically takes the chanlist which is in the format, ['76 spike', '13 wgme'...] and splits on the space, then pads the channel number with blank spaces and does a string compare. obviously you need to set 'sorted = "true"' for that to have any effect :)

also on a bog standard ntsc system these offsets seem to make it fit to the screen okay:

thexoffset = 40
theyoffset = 18

the ftpurl regex seems a bit broken and i didn't spend any time looking at it, i just hardcoded the values in, but might be worth some investigation.

mule.

Livin
2005-05-07, 08:48
my xmltv took a crap... all sorts of error now.

does it work for anyone today?

here's the junk i get...

fetching from datadirect: fetched 7 k/bytes in 6 seconds
##################################################
loading data: #################################################
warning: nerror parsing dd xml:

<insert bunch of crap here>

error: bad xml from dd, cannot continue

cruent
2005-05-07, 10:35
thanks a lot for the update mule, nice to see others dig into the problems and fix em :)

i do not have a lot of sparetime, why i made a quick release and its not perfect :p

cheers

Tomkun
2005-05-08, 07:04
does anyone know where i can get a compiled version of xmltv that supports japanese tv? the version i get off sourceforge doesn't support it. it is in the source apparantly, but i don't know how to compile it.

whodini
2005-05-08, 08:55
had a bit of a play with the script and added in support for channel icons as well as the facility to refine the channel list supplied by listing.xml. can download from here (although my example has australian tv channels):

http://sparkos.com/downloads/xbmc/tvguide.rar

also fixed up the background (the repeating texture down the left was slightly out of line) and added in a token image to the top right:

http://sparkos.com/downloads/xbmc/background.png

james

Livin
2005-05-09, 06:54
whodini,
i tried your mod... i get no buttons and no guide info. just the blank background you made.

also, it looks like xmltv supports downloading the channel icons.

wonder how difficult it would be to mod the script to add them automatically?

whodini
2005-05-09, 07:08
you probably need to edit the section in tvguide.py at the top which defines realchanlist.

basically its just an 2d array with three elements per item -- channel id (which matches up to the channel id in the listing.xml) display name (which is the name you'd like to see on screen) and icon (which refers to a png in the icons directory)

the realchanlist array is now also used in my version to order the channels on the screen, rather than sorting them alpha-numerically which doesn't work very well for the local australian channels.

i updated the version i put online and made it so that it only shows the display name if an icon is undefined and made it sort the channels properly. i will also make the left hand column, which has the icons/names in it, narrower.

i'm using tvharvest.exe (which is specific for aust. tv) to generate my listing.xml as i'm yet to find a version of xmltv that works reliable for the australian content. the disadvantage of this is i can't get it to automatically add the icons, or fix the display names, or put them in the order i'd like, hence my patch for the existing script.

james

Livin
2005-05-14, 05:05
whodini,
you seem pretty good with the python... can you mod the script to have an autocopy feature to copy over the listings.xml to the xbox every time the script is run?

ent
2005-05-15, 06:29
you probably need to edit the section in tvguide.py at the top which defines realchanlist.

basically its just an 2d array with three elements per item -- channel id (which matches up to the channel id in the listing.xml) display name (which is the name you'd like to see on screen) and icon (which refers to a png in the icons directory)

the realchanlist array is now also used in my version to order the channels on the screen, rather than sorting them alpha-numerically which doesn't work very well for the local australian channels.

i updated the version i put online and made it so that it only shows the display name if an icon is undefined and made it sort the channels properly. i will also make the left hand column, which has the icons/names in it, narrower.

i'm using tvharvest.exe (which is specific for aust. tv) to generate my listing.xml as i'm yet to find a version of xmltv that works reliable for the australian content. the disadvantage of this is i can't get it to automatically add the icons, or fix the display names, or put them in the order i'd like, hence my patch for the existing script.

james
hi whodini, i'm another aussie, long time ago i tried to get a good xmltv schedule going but didn't have much luck. would you mind posting your tvharvest.exe and config files, it'd be a great help!

Tomkun
2005-05-16, 11:57
could someone help me out and send me a link to a copy of xmltv that supports japanese tv? i looked at the source, but i don't know anything about perl.

thanks!