Adding to existing script
Posted on March 11th, 2010 by webmaster
import sys,os.path
DIR_HOME= os.getcwd()
if DIR_HOME[-1]==';': DIR_HOME=DIR_HOME[0:-1]
if DIR_HOME[-1]!='\': DIR_HOME=DIR_HOME+'\'
sys.path.insert(0, DIR_HOME+'System')
import xbmc, xbmcgui, re, os, time, datetime, tracebackurl, lib, urllib2, xbmcguifrom string import split, replace, find
THUMBDIR = os.getcwd().replace(";","")+"\images\thumbs\"
DIR_GFX = DIR_HOME + 'images\'
BACKGROUND_FILENAME = DIR_GFX + "background.png"
================================================== =======
html_data = self.gethtmldata("http://www.channelsurfing.net/watch-setanta-sports-news.html")
# select video links with a regular expression
googlevideolinkre = re.compile('live1(.*)net', re.IGNORECASE).findall(html_data)
===============================================
zenders = [
('Test - USA','mms://channelsurfing.net/' + googlevideolinkre + 'n'),
]
class DutchRadio(xbmcgui.Window):
def __init__(self):
xbmcgui.Window.__init__(self)
self.X = ( float(self.getWidth()) / float(720) )
self.Y = ( float(self.getHeight()) / float(480) )
self.addControl(xbmcgui.ControlImage(0,0,int(720*s elf.X),int(480*self.Y), BACKGROUND_FILENAME))
self.zenderlijst = xbmcgui.ControlList(240, 120, 300 , 400,'font15','0xFFFFFFFF')
self.addControl(self.zenderlijst)
self.setFocus(self.zenderlijst)
for i in zenders:
self.zenderlijst.addItem(i[0])
def onControl(self, control):
if control == self.zenderlijst:
self.position = self.zenderlijst.getSelectedPosition()
xbmc.Player().play(zenders[self.position][1])
w = DutchRadio()
w.doModal()
del w
Additional info: The link is updated all the time. I want to use regular expression to have the link automatically updated. Whenever i try to setup regular expression to retrieve the link and call the data from variable. i always get not defined error. I have boxed the area of code with the problem.
DIR_HOME= os.getcwd()
if DIR_HOME[-1]==';': DIR_HOME=DIR_HOME[0:-1]
if DIR_HOME[-1]!='\': DIR_HOME=DIR_HOME+'\'
sys.path.insert(0, DIR_HOME+'System')should instead be:
# replace the ; with nothing, not needed in later versions of xbmc, added for backward compability
DIR_HOME= os.getcwd().replace(';','')
# use os.path.join for creating paths, this will ensure we are platform safe.
sys.path.insert(0, os.path.join(DIR_HOME, 'System'))
#If you have any other info about this subject , Please add it free.# |