Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## imports epg data from vdr and prepares an output that can be used i.e with conky
- import sys
- import urllib
- def download_url(channel_num):
- url = 'http://127.0.0.1:8008/schedule.html?channel=%s' % (channel_num)
- texto = urllib.urlopen(url).read()
- texto = texto.decode('windows-1252')
- 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]+'\n'+'\n'
- if __name__ == '__main__':
- if len(sys.argv) == 2:
- param = str(sys.argv[1]).strip()
- download_url(param)
- else:
- print 'No channel specified.'
Advertisement
Add Comment
Please, Sign In to add comment