0 Replies - 391 Views - Last Post: 21 June 2014 - 08:57 AM Rate Topic: -----

#1 mark103  Icon User is offline

  • D.I.C Head

Reputation: -10
  • View blog
  • Posts: 107
  • Joined: 13-April 08

How to set the value in the setLabel function more than once?

Posted 21 June 2014 - 08:57 AM

Hi all,

I'm running on python version 2.6 for xbmc media application, but I'm having trouble with setLabel function.

When I run the code, it will update the value in the setLabel, but it will not allow me to update the values in the setLabel more than once.

Here it the code:

#DOWNLOAD THE XML SOURCE HERE
url = ADDON.getSetting('allchannels.url')
req = urllib2.Request(url)
response = urllib2.urlopen(req)
data = response.read()
response.close()
profilePath = xbmc.translatePath(os.path.join('special://userdata/addon_data/script.tvguide', ''))
self.getControl(4202).setLabel("1%")


if os.path.exists(profilePath):
   profilePath = profilePath + 'source.db'
   con = database.connect(profilePath)
   cur = con.cursor()
   cur.execute('CREATE TABLE programs(channel TEXT, title TEXT, start_date TIMESTAMP, stop_date TIMESTAMP, description TEXT)')
   con.commit()
   con.close
   tv_elem = ElementTree.parse(StringIO.StringIO(data)).getroot()
   channels = OrderedDict()

   # Get the loaded data
   for channel in tv_elem.findall('channel'):
       channel_name = channel.find('display-name').text
       for program in channel.findall('programme'):
            title = program.find('title').text
            start_time = program.get("start")
            stop_time = program.get("stop")
            cur.execute("INSERT INTO programs(channel, title, start_date, stop_date)" + " VALUES(?, ?, ?, ?)", [channel_name, title, start_time, stop_time])
            con.commit()
            con.close
            secondsLeft = 20 * (100 - 10) / 100
            secondsLeft -= secondsLeft % 10

            self.getControl(4202).setLabel(str(secondsLeft)+"%")




Do you know how I can set the value in the setLabel function more than once?

This post has been edited by mark103: 21 June 2014 - 09:02 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1