import urllib, os,re,urllib2 import xbmc,xbmcgui def DownloaderClass(url): dp = xbmcgui.DialogProgress() dp.create("MC360","Downloading File",url) try: urllib.urlretrieve(url,"e:\\test25125",lambda nb, bs, fs, url=url: _pbhook(nb,bs,fs,url,dp)) return 1 except: # OKAY DOWNLOAD CANCELD dp.close() return 0 def _pbhook(numblocks, blocksize, filesize, url=None,dp=None): try: percent = min((numblocks*blocksize*100)/filesize, 100) print percent dp.update(percent,"Downloading File") except: percent = 100 dp.update(percent) if dp.iscanceled(): print "DOWNLOAD CANCELLED" # need to get this part working raise IOError url ='http://ftp.iinet.net.au/adsl.test' DownloaderClass(url)