コード例 #1
0
def HUBINSTALL(name, url, script):
    a_list = []
    script_url = url
    link = kodi.open_url(script_url)
    matcher = script + '-(.+?).zip'
    match = re.compile(matcher).findall(link)
    for version in match:
        a_list.append(version)
    a_list.sort(cmp=ver_cmp, reverse=True)
    newest_v = script + '-' + a_list[0]
    newest_v_url = script_url + script + '-' + a_list[0] + '.zip'
    kodi.log("Looking for : " + newest_v_url)
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Starting up", "Initializing ", '', 'Please Stand By....')
    # lib = os.path.join(path, name + '.zip')
    lib = os.path.join(path, newest_v + '.zip')
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    if os.path.exists(lib):
        os.remove(lib)
    downloader.download(newest_v_url, lib, dp, timeout=120)
    try:
        # xbmc.executebuiltin("InstallAddon(%s)" % newest_v)
        extract.all(lib, addonfolder, '')
        time.sleep(2)
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
コード例 #2
0
ファイル: installer.py プロジェクト: anakondascc/xlations
def install_keymap(name, url):
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except:
            pass
    # Check is the packages folder exists, if not create it.
    path = xbmc.translatePath(os.path.join('special://home/addons', 'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = xbmc.translatePath(os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create("Keymap Installer", "", "", "[B]Keymap: [/B]" + buildname)
    buildname = "customkeymap"
    lib = os.path.join(path, buildname + '.zip')
    
    try:
        os.remove(lib)
    except:
        pass
    
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "", "Installing Please wait..", "")
    try:
        extract.all(lib, addonfolder, dp)
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
コード例 #3
0
def OPENSUBINSTALL(url):
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Please Wait", " ", '', 'Installing Official OpenSubtitles Addon')
    lib = os.path.join(path, 'opensubtitlesOfficial.zip')
    try:
        os.remove(lib)
    except OSError:
        pass
    page = kodi.open_url(url)
    url += re.search('''title="([^z]*zip)''', page).group(1)
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    try:
        extract.all(lib, addonfolder, '')
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
    # except IOError, (errno, strerror):
    #     kodi.message("Failed to open required files", "Error code is:", strerror)
    #     return False
    #
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    addon_able.set_enabled("service.subtitles.opensubtitles_by_opensubtitles")
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    dialog.ok("Installation Complete!", "    We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)
コード例 #4
0
def HUBINSTALL(name, url, script):
    aList = []
    script_url = url
    link = OPEN_URL(script_url)
    matcher = script + '-(.+?).zip'
    match = re.compile(matcher).findall(link)
    for version in match:
        aList.append(version)
    aList.sort(cmp=ver_cmp, reverse=True)
    newest_v = script + '-' + aList[0]
    newest_v_url = script_url + script + '-' + aList[0] + '.zip'
    kodi.log("Looking for : " + newest_v_url)
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Starting up", "Initializing ", '', 'Please Stand By....')
    # lib = os.path.join(path, name + '.zip')
    lib = os.path.join(path, newest_v + '.zip')
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    if os.path.exists(lib):
        os.remove(lib)
    downloader.download(newest_v_url, lib, dp, timeout=120)
    try:
        # xbmc.executebuiltin("InstallAddon(%s)" % newest_v)
        extract.all(lib, addonfolder, '')
        time.sleep(2)
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
コード例 #5
0
def install_keymap(name, url):
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except:
            pass
    # Check is the packages folder exists, if not create it.
    path = xbmc.translatePath(os.path.join('special://home/addons', 'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = xbmc.translatePath(os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create("Keymap Installer", "", "", "[B]Keymap: [/B]" + buildname)
    buildname = "customkeymap"
    lib = os.path.join(path, buildname + '.zip')
    
    try:
        os.remove(lib)
    except:
        pass
    
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "", "Installing Please wait..", "")
    try:
        extract.all(lib, addonfolder, dp)
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
コード例 #6
0
def allNoProgress(_in, _out):
	try:
		zin = zipfile.ZipFile(_in, 'r')
		zin.extractall(_out)

	except Exception as e:
		kodi.message("There was an error:", str(e), 'Please try again later, Attempting to continue...')
		return False

	return True
コード例 #7
0
def allNoProgress(_in, _out):
    import xbmcgui
    # xbmcgui.Dialog().ok('no progress', _in, _out)
    try:
        zin = zipfile.ZipFile(_in, 'r')
        zin.extractall(_out)

    except Exception as e:
        kodi.message("There was an error:", str(e), 'Please try again later, Attempting to continue...')
        return False
    return True
コード例 #8
0
def startup_freshstart():
    if kodi.yesnoDialog("Please confirm that you wish to factory restore your configuration.",
                        "                This will result in the loss of all your current data!",
                        ' ', AddonTitle, nolabel='No', yeslabel='Yes'):
        home_path = xbmc.translatePath(os.path.join('special://home'))
        enableBG16 = "UseCustomBackground,false"
        enableBG17 = "use_custom_bg,false"
        xEB('Skin.SetBool(%s)' % enableBG16)
        xEB('Skin.SetBool(%s)' % enableBG17)
        try:
            win_string = xbmc.translatePath(os.path.join('special://xbmc/')).split('\\')[-2]
            win_string = win_string.split('_')
            win_string = win_string[0] + '_' + win_string[-1]
            kodi.log(win_string)
            win_path = home_path.replace('\Roaming\Kodi', '\Local\Packages\%s\LocalCache\Roaming\Kodi' % win_string)
            if win_path:
                home_path = win_path
        except:
            pass
        #  Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ['metadata.album.universal', 'metadata.artists.universal', 'service.xbmc.versioncheck',
                           'metadata.common.musicbrainz.org', 'metadata.common.imdb.com']
        if kodi.yesnoDialog(AddonTitle, "Do you wish to keep %s installed for convenience after the factory restore?"
                            % AddonTitle, '', nolabel='No', yeslabel='Yes'):
            sub_dir_exclude.extend([AddonID])
        # Files to ignore and not to be removed
        file_exclude = ('kodi.log')  # , 'Textures13.db', 'commoncache.db', 'Addons26.db', 'Addons27.db')
        # db_vers = max(re.findall('Addons\d+.db', str(os.listdir(xbmc.translatePath('special://database')))))
        # file_exclude += db_vers
        try:
            for (root, dirs, files) in os.walk(home_path, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    try:
                        if folder not in dir_exclude:
                            shutil.rmtree(os.path.join(root, folder))
                    except:
                        pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
            kodi.message(AddonTitle, "Done! , You are now back to a fresh Kodi configuration!",
                         "Click OK to exit Kodi and then restart to complete .")
            xbmc.executebuiltin('ShutDown')
        except Exception as e:
            kodi.log("Freshstart User files partially removed - " + str(e))
            kodi.message(AddonTitle, 'Done! , Freshstart User files partially removed',
                         'Please check the log')
コード例 #9
0
def startup_freshstart():
    if kodi.yesno_dialog("Please confirm that you wish to factory restore your configuration.\n"+\
                        "                This will result in the loss of all your current data!\n"+\
                        ' ', nolabel='No', yeslabel='Yes'):
        home_path = translate_path(os.path.join('special://home'))
        enableBG16 = "UseCustomBackground,false"
        enableBG17 = "use_custom_bg,false"
        xEB('Skin.SetBool(%s)' % enableBG16)
        xEB('Skin.SetBool(%s)' % enableBG17)
        try:
            win_string = translate_path(os.path.join('special://xbmc/')).split('\\')[-2]
            win_string = win_string.split('_')
            win_string = win_string[0] + '_' + win_string[-1]
            kodi.log(win_string)
            win_path = home_path.replace('\Roaming\Kodi', '\Local\Packages\%s\LocalCache\Roaming\Kodi' % win_string)
            if win_path:
                home_path = win_path
        except:
            pass
        #  Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ['metadata.album.universal', 'metadata.artists.universal', 'service.xbmc.versioncheck',
                           'metadata.common.musicbrainz.org', 'metadata.common.imdb.com']
        if kodi.yesno_dialog(AddonTitle+ "\nDo you wish to keep %s installed for convenience after the factory restore?"
                            % AddonTitle, nolabel='No', yeslabel='Yes'):
            sub_dir_exclude.extend([AddonID])
        # Files to ignore and not to be removed
        file_exclude = ('kodi.log')  # , 'Textures13.db', 'commoncache.db', 'Addons26.db', 'Addons27.db')
        # db_vers = max(re.findall('Addons\d+.db', str(os.listdir(xbmc.translatePath('special://database')))))
        # file_exclude += db_vers
        try:
            for (root, dirs, files) in os.walk(home_path, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    try:
                        if folder not in dir_exclude:
                            shutil.rmtree(os.path.join(root, folder))
                    except:
                        pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
            kodi.message(AddonTitle, "Done! , You are now back to a fresh Kodi configuration!",
                         "Click OK to exit Kodi and then restart to complete .")
            xbmc.executebuiltin('ShutDown')
        except Exception as e:
            kodi.log("Freshstart User files partially removed - " + str(e))
            kodi.message(AddonTitle, 'Done! , Freshstart User files partially removed',
                         'Please check the log')
コード例 #10
0
ファイル: freshstart.py プロジェクト: enursha101/xbmc-addon
def startup_freshstart():
    yes_pressed = kodi.yesnoDialog(AddonTitle,
                                   "Please confirm that you wish to factory restore your configuration.",
                                   "                This will result in the loss of all your current data!")
    if yes_pressed:
        addonPath = xbmc.translatePath(os.path.join('special://home'))
        enableBG16 = "UseCustomBackground,false"
        enableBG17 = "use_custom_bg,false"
        xEB('Skin.SetBool(%s)' % enableBG16)
        xEB('Skin.SetBool(%s)' % enableBG17)
        try:
            winString = xbmc.translatePath(os.path.join('special://xbmc/')).split('\\')[-2]
            winString = winString.split('_')
            winString = winString[0] + '_' + winString[-1]
            kodi.log(winString)
            winPath = addonPath.replace('\Roaming\Kodi', '\Local\Packages\%s\LocalCache\Roaming\Kodi') % winString
            if winPath: addonPath = winPath
        except:
            pass
        #  Directories and sub directories not to remove but to sort through
        dir_exclude = ('addons', 'packages', 'userdata', 'Database')
        #  Directories and sub directories Directories to ignore and leave intact
        sub_dir_exclude = ('metadata.album.universal', 'metadata.artists.universal',
                           'service.xbmc.versioncheck', 'metadata.common.musicbrainz.org',
                           'metadata.common.imdb.com')
        keep_indigo = kodi.yesnoDialog(AddonTitle,
                                       "Do you wish to keep Computertechs Installer installed for convenience after the factory restore?",
                                       " ")
        if keep_indigo:
            sub_dir_exclude = sub_dir_exclude + ('plugin.video.nukewizard',)
        # Files to ignore and not to be removed
        file_exclude = ('Addons26.db', 'kodi.log', 'Textures13.db', 'commoncache.db, Addons27.db')
        try:
            for (root, dirs, files) in os.walk(addonPath, topdown=True):
                dirs[:] = [dir for dir in dirs if dir not in sub_dir_exclude]
                files[:] = [file for file in files if file not in file_exclude]
                for folder in dirs:
                    try:
                        if folder not in dir_exclude: shutil.rmtree(os.path.join(root, folder))
                    except:
                        pass
                for file_name in files:
                    try:
                        os.remove(os.path.join(root, file_name))
                    except:
                        pass
            kodi.message(AddonTitle, "Done! , You are now back to a fresh Kodi configuration!",
                         "Click OK to exit Kodi and then restart to complete .")
            xbmc.executebuiltin('ShutDown')
        except Exception as e:
            kodi.log("Freshstart User files partially removed - " + str(e))
            kodi.message(AddonTitle, 'Done! , Freshstart User files partially removed',
                         'Please check the log')
コード例 #11
0
def install_keymap(name, url):
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except OSError:
            pass
    # Check is the packages folder exists, if not create it.
    path = kodi.translate_path(
        os.path.join('special://home/addons', 'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = kodi.translate_path(
        os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create("Keymap Installer", "", "", "[B]Keymap: [/B]" + buildname)
    buildname = "customkeymap"
    lib = os.path.join(path, buildname + '.zip')

    try:
        os.remove(lib)
    except OSError:
        pass

    downloader.download(url, lib, dp, timeout=120)
    addonfolder = kodi.translate_path(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "", "Installing Please wait..", "")
    try:
        extract.extract_all(lib, addonfolder, dp)
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
    # except IOError, (errno, strerror):
    #     kodi.message("Failed to open required files", "Error code is:", strerror)
    #     return False

    time.sleep(1)
    try:
        os.remove(lib)
    except OSError:
        pass

    xbmc.executebuiltin("Container.Refresh")
    dialog.ok("Custom Keymap Installed!",
              "     We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)
コード例 #12
0
def hub_install(script, script_url, silent=False, dp=None):
    version, newest_v_url = get_url(script, script_url, kodi.open_url(script_url))
    kodi.log("Looking for : " + newest_v_url)
    if not silent:
        dp = xbmcgui.DialogProgress()
        dp.create("Starting up", "Initializing ", '', 'Please Stand By....')
    lib = os.path.join(packages_path, script + version + '.zip')
    os.remove(lib) if os.path.exists(lib) else ''
    downloader.download(newest_v_url, lib, dp, timeout=120)
    try:
        extract.extract_all(lib, addon_folder, None)
        time.sleep(2)
    except IOError as e:
        kodi.message("Failed to open required files", "Error is: ", str(e))
        return False
コード例 #13
0
def download(url, dest, dp=None, timeout=None, silent=False):
    if not timeout:
        timeout = 120
    try:
        if not silent:
            if not dp:
                dp = xbmcgui.DialogProgress()
                dp.create("Status...", "Checking Installation", ' ', ' ')
            dp.update(0)
        start_time = time.time()
        u = urlopen(url, timeout=timeout)
        h = u.info()
        totalSize = int(h["Content-Length"])
        fp = open(dest, 'wb')
        blockSize = 8192  # 100000 # urllib.urlretrieve uses 8192
        count = 0
        while True:  # and (end - start < 15):
            if time.time() - start_time > timeout:
                kodi.message(
                    "Slow or no Download available:",
                    'Files could not be downloaded at this time',
                    'Please try again later, Attempting to continue...')
                break
            chunk = u.read(blockSize)
            if not chunk: break
            fp.write(chunk)
            count += 1
            if totalSize > 0:
                try:
                    percent = int(count * blockSize * 100 / totalSize)
                    dp.update(percent) if not silent else ''
                except:
                    if not silent:
                        percent = 100
                        dp.update(percent)
                        if dp.iscanceled():
                            dp.close()
                            raise Exception("Canceled")
        timetaken = time.time() - start_time
        kodi.log('Duration of download was %.02f secs ' % timetaken)
    # except socket.timeout as e:
    except Exception as e:
        # For Python 2.7
        kodi.message("There was an error: %r" % e,
                     'Files could not be downloaded at this time',
                     'Please try again later, Attempting to continue...')
        return
コード例 #14
0
ファイル: installer.py プロジェクト: anakondascc/xlations
def OPENSUBINSTALL(url):
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress();
    dp.create("Please Wait", " ", '', 'Installing Official OpenSubtitles Addon')
    lib = os.path.join(path, 'opensubtitlesOfficial.zip')
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    try:
        extract.all(lib, addonfolder, '')
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
コード例 #15
0
def OPENSUBINSTALL(url):
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress();
    dp.create("Please Wait", " ", '', 'Installing Official OpenSubtitles Addon')
    lib = os.path.join(path, 'opensubtitlesOfficial.zip')
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp, timeout=120)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    try:
        extract.all(lib, addonfolder, '')
    except IOError, (errno, strerror):
        kodi.message("Failed to open required files", "Error code is:", strerror)
        return False
コード例 #16
0
def allWithProgress(_in, _out, dp):
    import xbmcgui
    # xbmcgui.Dialog().ok('with progress', _in, _out)
    try:
        zin = zipfile.ZipFile(_in, 'r')
        nFiles = float(len(zin.infolist()))
        count = 0
    except Exception as e:
        kodi.message("There was an error:", str(e), 'Please try again later, Attempting to continue...')
        return False
    try:
        for item in zin.infolist():
            count += 1
            update = count / nFiles * 100
            dp.update(int(update))
            zin.extract(item, _out)
    except Exception as e:
        kodi.message("There was an error:", str(e), 'Please try again later, Attempting to continue...')
        return False
    return True
コード例 #17
0
def download(url, dest, dp = None,timeout = None):
    if timeout == None:
        timeout = 120

    try:
        if not dp:
            dp = xbmcgui.DialogProgress()
            dp.create("Status...","Checking Installation",' ', ' ')
        dp.update(0)
        start_time = time.time()
        u = urllib2.urlopen(url, timeout = timeout)
        h = u.info()
        totalSize = int(h["Content-Length"])
        fp = open(dest, 'wb')
        blockSize = 8192 #100000 # urllib.urlretrieve uses 8192
        count = 0
        while True:  # and (end - start < 15):
            if time.time() - start_time > timeout:
                kodi.message("Slow or no Download available:", 'Files could not be downloaded at this time',
                             'Please try again later, Attempting to continue...')
                break
            chunk = u.read(blockSize)
            if not chunk: break
            fp.write(chunk)
            count += 1
            if totalSize > 0:
                try:
                    percent = int(count * blockSize * 100 / totalSize)
                    dp.update(percent)
                except:
                    percent = 100
                    dp.update(percent)
                if dp.iscanceled():
                    dp.close()
                    raise Exception("Canceled")
        timetaken =  time.time() - start_time
        kodi.log('Duration of download was %.02f secs ' % timetaken )
    except socket.timeout, e:
        # For Python 2.7
        kodi.message("There was an error: %r" % e, 'Files could not be downloaded at this time', 'Please try again later, Attempting to continue...')
        return
コード例 #18
0
def allWithProgress(_in, _out, dp):
    import xbmcgui
    # xbmcgui.Dialog().ok('with progress', _in, _out)
    try:
        zin = zipfile.ZipFile(_in, 'r')
        nFiles = float(len(zin.infolist()))
        count = 0
    except Exception as e:
        kodi.message("There was an error:", str(e),
                     'Please try again later, Attempting to continue...')
        return False
    try:
        for item in zin.infolist():
            count += 1
            update = count / nFiles * 100
            dp.update(int(update))
            zin.extract(item, _out)
    except Exception as e:
        kodi.message("There was an error:", str(e),
                     'Please try again later, Attempting to continue...')
        return False
    return True
コード例 #19
0
            if time.time() - start_time > timeout:
                kodi.message("Slow or no Download available:", 'Files could not be downloaded at this time',
                             'Please try again later, Attempting to continue...')
                break
            chunk = u.read(blockSize)
            if not chunk: break
            fp.write(chunk)
            count += 1
            if totalSize > 0:
                try:
                    percent = int(count * blockSize * 100 / totalSize)
                    dp.update(percent)
                except:
                    percent = 100
                    dp.update(percent)
                if dp.iscanceled():
                    dp.close()
                    raise Exception("Canceled")
        timetaken =  time.time() - start_time
        kodi.log('Duration of download was %.02f secs ' % timetaken )
    except socket.timeout, e:
        # For Python 2.7
        kodi.message("There was an error: %r" % e, 'Files could not be downloaded at this time', 'Please try again later, Attempting to continue...')
        return
    except urllib2.HTTPError as e:
        kodi.message("There was an error:", str(e),'Please try again later, Attempting to continue...')
        return



コード例 #20
0
                    'Files could not be downloaded at this time',
                    'Please try again later, Attempting to continue...')
                break
            chunk = u.read(blockSize)
            if not chunk:
                break
            fp.write(chunk)
            count += 1
            if totalSize > 0:
                try:
                    percent = int(count * blockSize * 100 / totalSize)
                    dp.update(percent)
                except:
                    percent = 100
                    dp.update(percent)
                if dp.iscanceled():
                    dp.close()
                    raise Exception("Canceled")
        timetaken = time.time() - start_time
        kodi.log('Duration of download was %.02f secs ' % timetaken)
    except socket.timeout, e:
        # For Python 2.7
        kodi.message("There was an error: %r" % e,
                     'Files could not be downloaded at this time',
                     'Please try again later, Attempting to continue...')
        return
    except Exception as e:
        kodi.message("There was an error:", str(e),
                     'Please try again later, Attempting to continue...')
        return