Hi.
I would like to use conky to display EPG on me desktop.
I found a cool website: http://nazham.com/2009/07/26/how-to-enhance-your-linux-desktop-with-conky/
and the owner, Mahzan Musa was very kind to provide his code. THANK YOU
Unfortunately his html epg source is completely different from mine and the code was not so easy to understand for a 1st starter.
After a week of reading and googling I was able to make my first python code:
import urllib
texto = urllib.urlopen('http://192.168.1.6:8008/schedule.html?channel=120').read()
index = texto.find('<td class="topaligned "><div class="withmargin nowrap"')
h1 = index+55
index = texto[h1:].find('><span class="title">')
pi1 = h1 + index + 21
index = texto[pi1:].find('</span><br')
pf1 = pi1 + index
index = texto[pf1:].find('<td class="topaligned "><div class="withmargin nowrap"')
h2 = pf1+index+55
index = texto[h2:].find('><span class="title">')
pi2 = h2 + index + 21
index = texto[pi2:].find('</span><br')
pf2 = pi2 + index
print texto[h1:h1+19]+' '+texto[pi1:pf1]+'\n'+texto[h2:h2+19]+' '+texto[pi2:pf2]
this is the output
08:00 PM - 08:30 PM As Princesas GÚmeas do Planeta Maravilha T.1 Ep.2
08:30 PM - 09:00 PM As Princesas GÚmeas do Planeta Maravilha T.1 Ep.3
It reads the html and print the 1st 2 shows, time and name. It's what I was looking for, now I can display this info with conky.
Now, I have a problem, I want more the one channel( 120 in the url on my code). I could copy paste and change the channel number and save n copies of it, but it's not the best option.
I would like to use a argument when running the py, like python epg.py channel number .
What do I have to change/implement to achieve this?