Adding to existing script

  • Hello, instead of creating a script from scratch i found that infinity TV to be easy for a beginner like myself. I simply added the lines of code to the existing script and it does not work. Basically, i am trying to copy a specific text from the html page: http://www.channelsurfing.net/watch-...orts-news.html. Once i have copied the text, i would like to append it to the end of mms://channelsurfing.net/.


    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.


  • i'm not sure what you mean by adding text to the end of the file.. but i do see one problem with the script..

    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.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Adding to existing script , Please add it free.