示例#1
0
def wizard(name, url, description):
    path = xbmc.translatePath(os.path.join('special://home', 'media'))
    dp = xbmcgui.DialogProgress()
    dp.create("Addon Selecionado", "Baixando ", '', 'Por Favor Espere')
    lib = os.path.join(path, name + '.zip')
    try:
        os.remove(lib)
    except:
        pass

    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(
        os.path.join('special://', 'home/', 'addons'))
    time.sleep(2)
    dp.update(0, "", "Instalando Por Favor Espere")
    print('=======================================')
    print(addonfolder)
    print('=======================================')
    extract.all(lib, addonfolder, dp)
    #dialog = xbmcgui.Dialog()
    #dialog.ok("Baixado com Sucesso:)", 'Para continuar a Instalacao irar ser solicitado que desligue o Kodi', 'Se for uma Box precione [COLOR yellow]NAO[/COLOR] depois sai do kodi para terminar a instalacao.','[COLOR yellow][B][Kodi 17][/B][/COLOR]Ao Voltar vai Addons em Meus Addons ativa o addons instalado')
    time.sleep(2)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    addon_able.set_enabled("")
    addon_able.setall_enable()
示例#2
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)
示例#3
0
def MyAddonInstaller(name, url, ToPath):
    if len(ToPath) == 0: return
    path = xbmc.translatePath(
        os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Addon Installer", "Downloading ", '', 'Please Wait')
    lib = os.path.join(path, name + '.zip')
    try:
        os.remove(lib)
    except:
        pass
    url = FireDrive(url)
    if '[error]' in url:
        print url
        dialog = xbmcgui.Dialog()
        dialog.ok("Error!", url)
        return
    else:
        print url
    downloader.download(url, lib, dp)
    addonfolder = ToPath
    time.sleep(2)
    dp.update(0, "", "Extracting Zip Please Wait")
    print '======================================='
    print addonfolder
    print '======================================='
    extract.all(lib, addonfolder, dp)
    time.sleep(2)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    addon_able.set_enabled("")
    dialog = xbmcgui.Dialog()
    dialog.ok("Addon Instaler", name + " has been installed", "", "")
示例#4
0
def depend_install(name, url):
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    lib = os.path.join(path, name + '.zip')
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    try:
        os.remove(lib)
    except OSError:
        pass
    download(url, lib, addonfolder, name)
    addon_able.set_enabled(name)
示例#5
0
def get_dir(script, source_url):
    match = re.findall(script + '(-.+?)?.zip', kodi.open_url(source_url))
    match.sort(reverse=True)
    version = match[0] if match else ''
    newest_v_url = source_url + script + version + '.zip'
    lib = os.path.join(packages_path, script + version + '.zip')
    os.remove(lib) if os.path.exists(lib) else ''
    downloader.download(newest_v_url, lib, None, timeout=120, silent=True)
    extract.extract_all(os.path.join(packages_path, lib), addonspath, None)
    addon_able.set_enabled(script)
    xbmc.executebuiltin("UpdateLocalAddons()")
示例#6
0
def DEPENDINSTALL(name, url):
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    lib = os.path.join(path, name + '.zip')
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    try:
        os.remove(lib)
    except OSError:
        pass
    download(url, lib, addonfolder, name)
    addon_able.set_enabled(name)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
def DEPENDINSTALL(name, url):
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    lib = os.path.join(path, name + '.zip')
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
    try:
        os.remove(lib)
    except:
        pass
    download(url, lib, addonfolder, name)

    addon_able.set_enabled(name)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
def enable_rtmp():
    try:
        addon_able.set_enabled("inputstream.adaptive")
    except Exception as e:
        kodi.log(str(e))
    time.sleep(0.5)
    try:
        addon_able.set_enabled("inputstream.rtmp")
    except Exception as e:
        kodi.log(str(e))
    time.sleep(0.5)
    dialog.ok("Operation Complete!", "Live Streaming has been Enabled!",
              "    Brought To You By %s " % siteTitle)
示例#9
0
def EnableRTMP():
    try:
        addon_able.set_enabled("inputstream.adaptive")
    except Exception as e:
        kodi.log(str(e))
    time.sleep(0.5)
    try:
        addon_able.set_enabled("inputstream.rtmp")
    except Exception as e:
        kodi.log(str(e))
    time.sleep(0.5)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    dialog.ok("Operation Complete!", "Live Streaming has been Enabled!",
              "    Brought To You By %s " % siteTitle)
def EnableRTMP():
    try:
        addon_able.set_enabled("inputstream.adaptive")
    except:
        pass
    time.sleep(0.5)
    try:
        addon_able.set_enabled("inputstream.rtmp")
    except:
        pass
    time.sleep(0.5)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    dialog.ok("Operation Complete!", "Live Streaming has been Enabled!",
              "    Brought To You By %s " % siteTitle)
示例#11
0
def DEPENDINSTALL(name, url, description, filetype, repourl):
    #Split Script Depends============================
    files = url.split('/')
    dependname = files[-1:]
    dependname = str(dependname)
    dependname = dependname.replace('[', '').replace(']', '').replace(
        '"', '').replace('[', '').replace("'", '').replace(".zip", '')
    #StoprSplit======================================
    path = xbmc.translatePath(
        os.path.join('special://home', 'addons', 'packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Configuring Requirements:", "Downloading and ", '',
              'Installing ' + name)
    lib = os.path.join(path, name + '.zip')
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp)
    if filetype == 'addon':
        addonfolder = xbmc.translatePath(
            os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    #dp.update(0,"","Installing selections.....")
    print '======================================='
    print addonfolder
    print '======================================='
    extract.all(lib, addonfolder, '')
    #Start Script Depend Search==================================================================
    depends = xbmc.translatePath(
        os.path.join('special://home', 'addons', dependname, 'addon.xml'))
    source = open(depends, mode='r')
    link = source.read()
    source.close()

    dmatch = re.compile('import addon="(.+?)"').findall(link)
    for requires in dmatch:
        if not 'xbmc.python' in requires:
            #kodi.log('Script Requires --- '+requires)
            dependspath = xbmc.translatePath(
                os.path.join('special://home', 'addons', requires))
            if not os.path.exists(dependspath):
                DEPENDINSTALL(
                    requires, indigo_url2 + 'installer/dependencies/' +
                    requires + '.zip', '', 'addon', 'none')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled(requires)
    #kodi.log("Creating enable for "+name)
    addon_able.set_enabled(name)
示例#12
0
def OPENSUBINSTALL(url):
    filetype = 'addon'
    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)
    if filetype == 'addon':
        addonfolder = xbmc.translatePath(
            os.path.join('special://', 'home', 'addons'))
    time.sleep(2)
    extract.all(lib, addonfolder, '')
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    addon_able.set_enabled("service.subtitles.opensubtitles_by_opensubtitles")
    dialog = xbmcgui.Dialog()
    dialog.ok("Installation Complete!",
              "    We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)
示例#13
0
def ADDONINSTALL(name,
                 url,
                 description,
                 filetype,
                 repourl,
                 Auto=False,
                 v='',
                 vO=''):
    #kodi.log("HERE IS THE INSTALL PROCESS")
    try:
        name = name.split('[COLOR FF0077D7]Install [/COLOR][COLOR FFFFFFFF]'
                          )[1].split('[/COLOR][COLOR FF0077D7] (v')[0]
    except:
        pass
    #Start Depend Setup================================================================================
    newfile = '-'.join(url.split('/')[-1].split('-')[:-1])
    ##folder=newfile.split('/');
    addonname = str(newfile).replace('[', '').replace(']', '').replace(
        '"', '').replace('[', '').replace("'", '')
    #kodi.log('newfile'+newfile+'addonname'+addonname);

    print 'SOURCE FILE IS ' + addonname
    #End of Depend Setup==================================================================================
    path = xbmc.translatePath(
        os.path.join('special://home', 'addons', 'packages'))
    vTag = ''
    if len(v) > 0: vTag += " v" + v
    if len(vO) > 0: vTag += " [local v" + vO + "]"
    confirm = xbmcgui.Dialog().yesno(
        "Please Confirm",
        "                Do you wish to install the chosen add-on and",
        "                        its respective repository if needed?              ",
        "              ", "Cancel", "Install")
    #if Auto==True: confirm=True
    if confirm:
        dp = xbmcgui.DialogProgress()
        dp.create("Download Progress:", "Downloading your selection ", '',
                  'Please Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except:
            pass
        downloader.download(url, lib, dp)
        if filetype == 'addon':
            addonfolder = xbmc.translatePath(
                os.path.join('special://', 'home', 'addons'))
        elif filetype == 'media':
            addonfolder = xbmc.translatePath(os.path.join(
                'special://', 'home'))
        elif filetype == 'main':
            addonfolder = xbmc.translatePath(os.path.join(
                'special://', 'home'))
        time.sleep(2)
        extract.all(lib, addonfolder, dp)
        try:
            #Start Addon Depend Search==================================================================
            depends = xbmc.translatePath(
                os.path.join('special://home', 'addons', addonname,
                             'addon.xml'))
            source = open(depends, mode='r')
            link = source.read()
            source.close()
            dmatch = re.compile('import addon="(.+?)"').findall(link)
            for requires in dmatch:
                if not 'xbmc.python' in requires:
                    print 'Requires --- ' + requires
                    dependspath = xbmc.translatePath(
                        os.path.join('special://home/addons', requires))
                    print dependspath
                    if not os.path.exists(dependspath):
                        DEPENDINSTALL(
                            requires, indigo_url2 + 'installer/dependencies/' +
                            requires + '.zip', '', 'addon', 'none')
        except:
            traceback.print_exc(file=sys.stdout)
        #End Addon Depend Search======================================================================
        if 'none' not in repourl:
            path = xbmc.translatePath(
                os.path.join('special://home/addons', 'packages'))
            dp = xbmcgui.DialogProgress()
            dp.create("Updating Repo if needed:", "Configuring Installation ",
                      '', ' ')
            lib = os.path.join(path, name + '.zip')
            #kodi.log("REPO TO INSTALL IS  "+repourl)
            files = repourl.split('/')
            dependname = files[-1:]
            dependname = str(dependname)
            reponame = dependname.split('-')
            #print reponame
            nextname = reponame[:-1]
            #print nextname
            nextname = str(nextname).replace('[', '').replace(']', '').replace(
                '"', '').replace('[', '').replace("'", '').replace(".zip", '')
            #print nextname
            #kodi.log("REPO TO ENABLE IS  "+nextname)
            try:
                os.remove(lib)
            except:
                pass
            downloader.download(repourl, lib, '')
            if filetype == 'addon':
                addonfolder = xbmc.translatePath(
                    os.path.join('special://', 'home/addons'))
            elif filetype == 'media':
                addonfolder = xbmc.translatePath(
                    os.path.join('special://', 'home'))
            elif filetype == 'main':
                addonfolder = xbmc.translatePath(
                    os.path.join('special://', 'home'))
            time.sleep(2)
            #dp.update(0,"","Checking Installation......")
            extract.all(lib, addonfolder, dp)
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled(nextname)
            addon_able.set_enabled(addonname)

            dialog = xbmcgui.Dialog()
            if Auto == True:
                Note("Installation Complete!", name + " " + v + " Installed")
            else:
                dialog.ok("Installation Complete!",
                          "    We hope you enjoy your Kodi addon experience!",
                          "    Brought To You By %s " % siteTitle)
        else:
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled(addonname)
            dialog = xbmcgui.Dialog()
            if Auto == True: Note("Success!", name + " " + v + " Installed")
            else:
                dialog.ok(
                    "Installation Complete!",
                    "     We hope you enjoy your Kodi addon experience!",
                    "    Brought To You By %s " % siteTitle)
        '''confirm=xbmcgui.Dialog().yesno("Installation Complete!","                Please Restart To Take Effect","                        Brought To You By %s              "% siteTitle,"                    ","Later","Restart")
		if confirm: xbmc.executebuiltin('Quit')
		else: pass'''
    else:
        return
示例#14
0
def main_menu():
    maintool.source_change()
    maintool.feed_change()
    # ########## TRY POP ########
    if len(kodi.get_setting('notify')) > 0:
        kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1))
    else:
        kodi.set_setting('notify', "1")
    if int(kodi.get_setting('notify')) == 1:
        xbmcgui.Dialog().notification('Need Support?', 'www.tvaddons.co',
                                      artwork + 'icon.png', 3000, False)
    elif int(kodi.get_setting('notify')) == 5:
        kodi.set_setting('notify', "0")
    # ######## END POP ###########

    if kodi.get_setting('hasran') == 'false':
        kodi.set_setting('hasran', 'true')

    dp = xbmcgui.DialogProgress()
    try:
        if (not os.path.exists(ART)) or (not os.path.exists(ART2)) or (
                not os.path.exists(ART3)):
            dp.create(AddonTitle, 'Getting ' + AddonTitle + ' Ready......',
                      'Downloading ' + AddonTitle + ' Icons.....')
            dp.update(0)
            icons_zip = os.path.join(packagepath, AddonTitle + '_icons.zip')
            downloader.download(
                OPEN_URL('http://indigo.tvaddons.co/graphics/arts.txt'),
                icons_zip, dp)
            dp.update(0, 'Getting %s Ready........' % AddonTitle,
                      'Extracting %s Icons......' % AddonTitle)
            extract.all(icons_zip, addon_path, dp)
            dp.close()
    except:
        pass
    # Check for old version of hubrepo and remove it
    try:
        if os.path.exists(hubpath):
            with open(hubpath, 'r') as content:
                if 'AG' in content:
                    shutil.rmtree(hubpath)
    except:
        pass
    # # Check for HUBRepo and install it
    try:
        if not os.path.exists(hubpath):
            installer.HUBINSTALL(
                'repository.xbmchub',
                'http://github.com/tvaddonsco/tva-release-repo/raw/master/'
                'repository.xbmchub/', 'repository.xbmchub')
            xbmc.executebuiltin("XBMC.InstallAddon(%s)" % 'repository.xbmchub')
            addon_able.set_enabled("repository.xbmchub")
            xbmc.executebuiltin("XBMC.UpdateAddonRepos()")
    except:
        pass
    # Check for Log Uploader and install it
    try:
        if not os.path.exists(uploaderpath):
            installer.HUBINSTALL(
                'script.tvaddons.debug.log',
                'http://github.com/tvaddonsco/tva-release-repo/raw/master'
                '/script.tvaddons.debug.log/', 'script.tvaddons.debug.log')
            addon_able.set_enabled('script.tvaddons.debug.log')
            # xbmc.executebuiltin("InstallAddon(%s)" % 'script.tvaddons.debug.log')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    except:
        pass

    # Check for old maintenance tools and remove them
    old_maintenance = (oldinstaller, oldnotify, oldmain, oldwiz, oldfresh)
    for old_file in old_maintenance:
        if os.path.exists(old_file):
            shutil.rmtree(old_file)

    # Notification Status
    if kodi.get_setting("notifications-on-startup") == "false":
        note_status = '(Opt Out)'
        note_art = 'notification_optout.png'
        note_description = 'Unsubscribe'
    else:
        note_status = '(Opt In)'
        note_art = 'notification_in.png'
        note_description = 'Subscribe'

    if kodi.get_setting('wizardran') == 'false':
        kodi.addItem(
            "Config Wizard",
            '',
            'call_wizard',
            artwork + 'config_wizard.png',
            description=
            "Automatically configure Kodi with the best addons and goodies in seconds!"
        )
    kodi.addDir("Addon Installer",
                '',
                'call_installer',
                artwork + 'addon_installer.png',
                description="It’s like an App Store for Kodi addons!")
    kodi.addDir(
        "Maintenance Tools",
        '',
        'call_maintool',
        artwork + 'maintool.png',
        description="Keep your Kodi setup running at optimum performance!")
    # kodi.addDir("Kodi Librtmp Files", '', 'get_libs', artwork +'librtmp_files.png')
    kodi.addItem(
        "Rejuvenate Kodi",
        '',
        'call_rejuv',
        artwork + 'rejuvinate.png',
        description=
        "Wipe and reconfigure Kodi with the latest Config Wizard setup!")
    kodi.addDir("Factory Restore",
                '',
                'call_restore',
                artwork + 'factory_restore.png',
                description="Start off fresh, wipe your Kodi setup clean!")
    if os.path.exists(uploaderpath):
        kodi.addItem(
            "Log Uploader",
            '',
            'log_upload',
            artwork + 'log_uploader.png',
            description="Easily upload your error logs for troubleshooting!")
    kodi.addDir("Network Speed Test",
                '',
                'runspeedtest',
                artwork + 'speed_test.png',
                description="How fast is your internet?")
    kodi.addDir("System Information",
                '',
                'system_info',
                artwork + 'system_info.png',
                description="Useful information about your Kodi setup!")
    kodi.addDir("Sports Listings",
                '',
                'call_sports',
                artwork + 'sports_list.png',
                description="Who’s playing what today?")
    kodi.addDir(
        'Backup / Restore',
        '',
        'backup_restore',
        artwork + 'backup_restore.png',
        description="Backup or restore your Kodi configuration in minutes!")
    kodi.addItem(
        "Log Viewer",
        '',
        'log_view',
        artwork + 'log_viewer.png',
        description="Easily view your error log without leaving Kodi!")
    kodi.addItem("No-Coin Scan",
                 '',
                 'nocoin',
                 artwork + 'no_coin.png',
                 description="Scan your Kodi directory for coin mining.")
    kodi.addItem(
        "Notifications " + note_status,
        '',
        'toggle_notify',
        artwork + note_art,
        description="%s to important TV ADDONS notifications on startup!" %
        note_description)
    kodi.addItem(
        "Show Notification",
        '',
        'show_note',
        artwork + 'notification.png',
        description=
        "Show TVA Notification. To get Important News, Tips, and Giveaways from TV ADDONS"
    )
    viewsetter.set_view("sets")
示例#15
0
if xbmc.getCondVisibility('System.HasAddon(script.service.twitter)'):
    search_string = xbmcaddon.Addon('script.service.twitter').getSetting('search_string')
    search_string = search_string.replace('from:@', 'from:')
    xbmcaddon.Addon('script.service.twitter').setSetting('search_string', search_string)
    xbmcaddon.Addon('script.service.twitter').setSetting('enable_service', 'false')

# ################################################## ##
date = datetime.datetime.today().weekday()
if  (kodi.get_setting("clearday") == date) or kodi.get_setting("acstartup") == "true":
    import maintool
    maintool.auto_clean(True)

# ################################################## ##
if kodi.get_setting('set_rtmp') == 'false':
    try:
        addon_able.set_enabled("inputstream.adaptive")
    except:
        pass
    time.sleep(0.5)
    try:
        addon_able.set_enabled("inputstream.rtmp")
    except:
        pass
    time.sleep(0.5)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    kodi.set_setting('set_rtmp', 'true')
    time.sleep(0.5)

# ################################################## ##
run_once_path = xbmc.translatePath(os.path.join('special://home', 'addons', addon_id, 'resources', 'run_once.py'))
if kodi.get_var(run_once_path, 'hasran') == 'false':
示例#16
0
def main_menu():

    # sourcePath = xbmc.translatePath(os.path.join('special://home','userdata'))
    # newSource = sourcePath+"/sources.xml"
    #
    # with open(newSource) as f:
    #   file_str = f.read()
    #   if 'fusion' not in file_str:
    #       kodi.log("FUSION NOT FOUND")
    #
    #       # do stuff with file_str
    #       #kodi.log(file_str)
    #       with open(newSource, "w") as f:
    #           f.write(file_str)
    #   else:
    #       kodi.log("FUSION IS INSTALLED")

    ###########TRY POP########
    if len(kodi.get_setting('notify')) > 0:
        kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1))
    else:
        kodi.set_setting('notify', "1")
    if int(kodi.get_setting('notify')) == 1:
        xbmcgui.Dialog().notification('Need Support?', 'www.tvaddons.ag',
                                      artwork + 'icon.png', 3000, False)
    elif int(kodi.get_setting('notify')) == 5:
        kodi.set_setting('notify', "0")
    #########END POP###########

    if kodi.get_setting('hasran') == 'false':
        kodi.set_setting('hasran', 'true')

    if kodi.get_setting('set_rtmp') == 'false':
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        time.sleep(0.5)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        time.sleep(0.5)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        kodi.set_setting('set_rtmp', 'true')
    try:
        if not os.path.exists(hubpath):
            installer.HUBINSTALL(
                'TVADDONSRepo',
                'http://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/repository.xbmchub/',
                'repository.xbmchub')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled("repository.xbmchub")
    except:
        pass
    try:
        if not os.path.exists(uploaderpath):
            installer.HUBINSTALL(
                'TVADDONSLogUploader',
                'https://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/script.tvaddons.debug.log/',
                'script.tvaddons.debug.log')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled("script.tvaddons.debug.log")
    except:
        pass

    if os.path.exists(oldinstaller):
        shutil.rmtree(oldinstaller)
    if os.path.exists(oldnotify):
        shutil.rmtree(oldnotify)
    if os.path.exists(oldmain):
        shutil.rmtree(oldmain)
    if os.path.exists(oldwiz):
        shutil.rmtree(oldwiz)
    if os.path.exists(oldfresh):
        shutil.rmtree(oldfresh)

    kodi.addDir("Addon Installer",
                '',
                'call_installer',
                artwork + 'addon_installer.png',
                description="It’s like an App Store for Kodi addons!")
    kodi.addDir(
        "Maintenance Tools",
        '',
        'call_maintool',
        artwork + 'maintool.png',
        description="Keep your Kodi setup running at optimum performance!")
    #kodi.addDir("Kodi Librtmp Files",'','get_libs',artwork+'librtmp_files.png')
    kodi.addDir("Factory Restore",
                '',
                'call_restore',
                artwork + 'factory_restore.png',
                description="Start off fresh, wipe your Kodi setup clean!")
    kodi.addItem(
        "Log Uploader",
        '',
        'log_upload',
        artwork + 'log_uploader.png',
        description="Easily upload your error logs for troubleshooting!")
    kodi.addDir("Network Speed Test",
                '',
                'runspeedtest',
                artwork + 'speed_test.png',
                description="How fast is your internet?")
    kodi.addDir("System Information",
                '',
                'system_info',
                artwork + 'system_info.png',
                description="Useful information about your Kodi setup!")
    kodi.addDir("Sports Listings",
                '',
                'call_sports',
                artwork + 'sports_list.png',
                description="Who’s playing what today?")
    kodi.addDir(
        'Backup / Restore',
        '',
        'backup_restore',
        artwork + 'backup_restore.png',
        description="Backup or restore your Kodi configuration in minutes!")
    kodi.addItem(
        "Log Viewer",
        '',
        'log_view',
        artwork + 'log_uploader.png',
        description="Easily view your error log without leaving Kodi!")
    if kodi.get_setting('notifications-on-startup') == 'false':
        kodi.addItem(
            "Notifications (Opt Out)",
            '',
            'enable_notify',
            artwork + 'notification_optout.png',
            description="Unsubscribe from important TV ADDONS notifications!")
    if kodi.get_setting('notifications-on-startup') == 'true':
        kodi.addItem(
            "Notifications (Opt In)",
            '',
            'disable_notify',
            artwork + 'notification_in.png',
            description="Subscribe to important TV ADDONS notifications!")

    viewsetter.set_view("sets")
示例#17
0
def JUVWIZARD(filetype='main'):
    if xbmcgui.Dialog().yesno(
            "Please Confirm",
            "                Please confirm that you wish to automatically",
            "            configure Kodi with all the best addons and tweaks!",
            "              ", "Cancel", "Install"):
        filetype = filetype.lower()
        if filetype == 'main':
            addonfolder = kodi.translate_path('special://home')
        elif filetype == 'addon':
            addonfolder = kodi.translate_path(
                os.path.join('special://home', 'addons'))
        else:
            print({'filetype': filetype})
            dialog.ok("Error!", 'filetype: "%s"' % str(filetype))
            return
        link = kodi.read_file(wizlink).replace('\n',
                                               '').replace('\r', '').replace(
                                                   '\a', '').strip()
        # kodi.log(link)
        if '[error]' in link:
            print(link)
            dialog.ok("Error!", link)
            return
        path = kodi.translate_path(
            os.path.join('special://home', 'addons', 'packages'))
        lib = os.path.join(path, 'rejuv.zip')
        try:
            os.remove(lib)
        except:
            pass
        # ## ## ... ##
        dp = xbmcgui.DialogProgress()
        dp.create(AddonTitle, " ", 'Downloading and Configuring ',
                  'Please Wait')
        downloader.download(link, lib, dp)
        xbmc.sleep(4000)
        extract.extract_all(lib, addonfolder, dp)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        addon_able.setall_enable()
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        xbmc.sleep(4000)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        try:
            os.remove(lib)
        except:
            pass
        if filetype == 'main':
            link = kodi.read_file(cutslink)
            shorts = re.compile('shortcut="(.+?)"').findall(link)
            for shortname in shorts:
                xEB('Skin.SetString(%s)' % shortname)
                enableBG16 = "UseCustomBackground,true"
                enableBG17 = "use_custom_bg,true"
                xEB('Skin.SetBool(%s)' % enableBG16)
                xEB('Skin.SetBool(%s)' % enableBG17)

        kodi.set_setting("wizardran", 'true')
        dialog.ok(AddonTitle, "Installation Complete.", "",
                  "Click OK to exit Kodi and then restart to complete .")
        xbmc.executebuiltin('ShutDown')
示例#18
0
    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
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    addon_able.set_enabled("service.subtitles.opensubtitles_by_opensubtitles")
    dialog.ok("Installation Complete!", "    We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)


# #################################################################


# #****************************************************************
def set_content(content):
    xbmcplugin.setContent(int(sys.argv[1]), content)


# HELPDIR**************************************************************
def addDir(name, url, mode, thumb):
    u = sys.argv[0] + "?url=" + urllib.quote_plus(url) + "&mode=" + str(mode) + "&name=" + urllib.quote_plus(name);
示例#19
0
def HELPWIZARD(name, url, description, filetype):
    # path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    filetype = filetype.lower()
    if xbmcgui.Dialog().yesno("Please Confirm",
                              "                Please confirm that you wish to automatically",
                              "            configure Kodi with all the best addons and tweaks!",
                              "              ", "Cancel", "Install"):
        path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
        dp = xbmcgui.DialogProgress()
        dp.create(AddonTitle, " ", 'Downloading and Configuring ', 'Please Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except:
            pass
        # ## ## ... ##
        # kodi.log(url)
        # if str(url).endswith('[error]'):
        #     print(url)
        #     dialog = xbmcgui.Dialog()
        #     dialog.ok("Error!", url)
        #     return
        if '[error]' in url:
            print(url)
            dialog = xbmcgui.Dialog()
            dialog.ok("Error!", url)
            return
        downloader.download(url, lib, dp)
        if not os.path.exists(lib):
            return
        if filetype == 'main':
            addonfolder = xbmc.translatePath('special://home')
        elif filetype == 'addon':
            addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons'))
        else:
            print({'filetype': filetype})
            dialog = xbmcgui.Dialog()
            dialog.ok("Error!", 'filetype: "%s"' % str(filetype))
            return
        xbmc.sleep(4000)
        extract.all(lib, addonfolder, dp)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        addon_able.setall_enable()
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        xbmc.sleep(4000)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        try:
            os.remove(lib)
        except:
            pass
        if filetype == 'main':
            link = kodi.read_file(cutslink)
            shorts = re.compile('shortcut="(.+?)"').findall(link)
            for shortname in shorts:
                xEB('Skin.SetString(%s)' % shortname)
                enableBG16 = "UseCustomBackground,true"
                enableBG17 = "use_custom_bg,true"
                xEB('Skin.SetBool(%s)' % enableBG16)
                xEB('Skin.SetBool(%s)' % enableBG17)

        xbmc.sleep(4000)
        xbmc.executebuiltin('XBMC_UpdateLocalAddons()')
        addon_able.setall_enable()
        # try:
        #     addon_able.set_enabled("inputstream.adaptive")
        # except:
        #     pass
        # xbmc.sleep(4000)
        # try:
        #     addon_able.set_enabled("inputstream.rtmp")
        # except:
        #     pass
        kodi.set_setting("wizardran", 'true')

        dialog = xbmcgui.Dialog()
        dialog.ok(AddonTitle, "Installation Complete!", "", "Click OK to exit Kodi and then restart to complete .")
        xbmc.executebuiltin('ShutDown')
示例#20
0
def main_menu():
    maintool.source_change()
    maintool.feed_change()
    # ########## TRY POP ########
    if len(kodi.get_setting('notify')) > 0:
        kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1))
    else:
        kodi.set_setting('notify', "1")
    if int(kodi.get_setting('notify')) == 1:
        xbmcgui.Dialog().notification('Need Support?', 'www.tvaddons.co', artwork + 'icon.png', 3000, False)
    elif int(kodi.get_setting('notify')) == 5:
        kodi.set_setting('notify', "0")
    # ######## END POP ###########

    if kodi.get_setting('hasran') == 'false':
        kodi.set_setting('hasran', 'true')

    if kodi.get_setting('set_rtmp') == 'false':
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        time.sleep(0.5)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        time.sleep(0.5)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        kodi.set_setting('set_rtmp', 'true')
        
    dp = xbmcgui.DialogProgress()
    try:
        if (not os.path.exists(ART)) or (not os.path.exists(ART2)) or (not os.path.exists(ART3)):
            dp.create(AddonTitle, 'Getting ' + AddonTitle + ' Ready........', 'Downloading ' + AddonTitle + ' Icons......')
            dp.update(0)
            icons_zip = os.path.join(packagepath, AddonTitle + '_icons.zip')
            downloader.download(OPEN_URL('http://indigo.tvaddons.co/graphics/arts.txt'), icons_zip, dp)
            dp.update(0, 'Getting %s Ready........' % AddonTitle, 'Extracting %s Icons......' % AddonTitle)
            extract.all(icons_zip, addon_path, dp)
            dp.close()
    except:
        pass
    # # Check for HUBRepo and install it
    try:
        if not os.path.exists(hubpath):
            installer.HUBINSTALL('repository.xbmchub', 'http://github.com/tvaddonsco/tva-release-repo/raw/master/repository.xbmchub/', 'repository.xbmchub')
            xbmc.executebuiltin("XBMC.InstallAddon(%s)" % 'repository.xbmchub')
            addon_able.set_enabled("repository.xbmchub")
            xbmc.executebuiltin("XBMC.UpdateAddonRepos()")

    except:
        pass
    # Check for Log Uploader and install it
    try:
        if not os.path.exists(uploaderpath):
            installer.HUBINSTALL('script.tvaddons.debug.log', 'http://github.com/tvaddonsco/tva-release-repo/raw/master/script.tvaddons.debug.log/', 'script.tvaddons.debug.log')
            addon_able.set_enabled('script.tvaddons.debug.log')
            # xbmc.executebuiltin("InstallAddon(%s)" % 'script.tvaddons.debug.log')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")

    except:
        pass
   
    # Check for old maintenance tools and remove them
    old_maintenance = (oldinstaller, oldnotify, oldmain, oldwiz, oldfresh)
    for old_file in old_maintenance:
        if os.path.exists(old_file):
            shutil.rmtree(old_file)

    if kodi.get_setting('wizardran') == 'false':
        kodi.addItem("Config Wizard", '', 'call_wizard',artwork+'config_wizard.png',
                     description="Automatically configure Kodi with the best addons and goodies in seconds!")
    kodi.addDir("Addon Installer", '', 'call_installer', artwork + 'addon_installer.png',
                description="It’s like an App Store for Kodi addons!")
    kodi.addDir("Maintenance Tools", '', 'call_maintool', artwork + 'maintool.png',
                description="Keep your Kodi setup running at optimum performance!")
    # kodi.addDir("Kodi Librtmp Files", '', 'get_libs', artwork +'librtmp_files.png')
    kodi.addItem("Rejuvenate Kodi", '', 'call_rejuv', artwork + 'rejuvinate.png',
                 description="Wipe and reconfigure Kodi with the latest Config Wizard setup!")
    kodi.addDir("Factory Restore", '', 'call_restore', artwork + 'factory_restore.png',
                description="Start off fresh, wipe your Kodi setup clean!")
    if os.path.exists(uploaderpath):
        kodi.addItem("Log Uploader", '', 'log_upload', artwork + 'log_uploader.png',
                     description="Easily upload your error logs for troubleshooting!")
    kodi.addDir("Network Speed Test", '', 'runspeedtest', artwork + 'speed_test.png',
                description="How fast is your internet?")
    kodi.addDir("System Information", '', 'system_info', artwork + 'system_info.png',
                description="Useful information about your Kodi setup!")
    kodi.addDir("Sports Listings", '', 'call_sports', artwork + 'sports_list.png',
                description="Who’s playing what today?")
    kodi.addDir('Backup / Restore', '', 'backup_restore', artwork + 'backup_restore.png',
                description="Backup or restore your Kodi configuration in minutes!")
    kodi.addItem("Log Viewer", '', 'log_view', artwork + 'log_viewer.png',
                 description="Easily view your error log without leaving Kodi!")
    if kodi.get_setting("notifications-on-startup") == "false":
        kodi.addItem("Notifications (Opt Out)", '', 'toggle_notify', artwork + 'notification_optout.png',
                     description="Unsubscribe to important TV ADDONS notifications!")
    else:
        kodi.addItem("Notifications (Opt In)", '', 'toggle_notify', artwork + 'notification_in.png',
                     description="Subscribe from important TV ADDONS notifications!")
    viewsetter.set_view("sets")
示例#21
0
def ADDONINSTALL(name, url, description, filetype, repourl, Auto=False, v='', vO=''):
    try:
        name = name.split('[COLOR FF0077D7]Install [/COLOR][COLOR FFFFFFFF]')[1].split('[/COLOR][COLOR FF0077D7] (v')[0]
    except Exception as e:
        kodi.log(str(e))
        traceback.print_exc(file=sys.stdout)
    kodi.log("Installer: Installing: " + name)
    addonname = '-'.join(url.split('/')[-1].split('-')[:-1])
    addonname = str(addonname).replace('[', '').replace(']', '').replace('"', '').replace('[', '').replace("'", '')
    try:
        addonname = re.search('(.+?)($|-\d+\.)', addonname).group(1)
    except Exception as e:
        kodi.log(str(e))
        traceback.print_exc(file=sys.stdout)
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    if xbmcgui.Dialog().yesno("Please Confirm", "                Do you wish to install the chosen add-on and",
                              "                        its respective repository if needed?",
                              "                            ", "Cancel", "Install"):
        if 'tva-release-repo' in url:
            url = get_max_version(addonname, url, tva_repo)
        dp = xbmcgui.DialogProgress()
        dp.create("Download Progress:", "", '', 'Please Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except OSError:
            pass
        addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
        download(url, lib, addonfolder, name)
        addon_able.set_enabled(addonname)
        try:
            dataurl = repourl.split("repository", 1)[0]

            # Start Addon Depend Search ==================================================================
            depends = xbmc.translatePath(os.path.join('special://home', 'addons', addonname, 'addon.xml'))
            source = open(depends, mode='r')
            link = source.read()
            source.close()
            dmatch = re.compile('import addon="(.+)"').findall(link)
            for requires in dmatch:
                if 'xbmc.python' not in requires:
                    if 'xbmc.gui' not in requires:
                        dependspath = xbmc.translatePath(os.path.join('special://home/addons', requires))
                        if not os.path.exists(dependspath):
                            NEW_Depend(dataurl, requires)
                            Deep_Depends(dataurl, requires)
        except Exception as e:
            kodi.log(str(e))
            traceback.print_exc(file=sys.stdout)
        # # End Addon Depend Search ======================================================================

        kodi.log("STARTING REPO INSTALL")
        kodi.log("Installer: Repo is : " + repourl)
        if repourl:
            if 'None' not in repourl:
                path = xbmc.translatePath(os.path.join('special://home/addons', 'packages'))
                repo_name = str(repourl.split('/')[-1:]).split('-')[:-1]
                repo_name = str(repo_name).replace('[', '').replace(']', '').replace('"', '').replace('[', '')\
                    .replace("'", '').replace(".zip", '')
                if 'tva-release-repo' in repourl:
                    repourl = get_max_version(repo_name, repourl, tva_repo)
                lib = os.path.join(path, repo_name + '.zip')
                try:
                    os.remove(lib)
                except Exception as e:
                    kodi.log(str(e))
                addonfolder = xbmc.translatePath(os.path.join('special://', 'home/addons'))
                download(repourl, lib, addonfolder, repo_name)
                kodi.log("REPO TO ENABLE IS  " + repo_name)
                addon_able.set_enabled(repo_name)

        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        xbmc.executebuiltin("XBMC.UpdateAddonRepos()")
        if not dialog.yesno(siteTitle, '                     Click Continue to install more addons or',
                            '                    Restart button to finalize addon installation',
                            "                          Brought To You By %s " % siteTitle,
                            nolabel='Restart', yeslabel='Continue'):
            xbmc.executebuiltin('ShutDown')
    else:
        return
    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
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    addon_able.set_enabled("service.subtitles.opensubtitles_by_opensubtitles")
    dialog.ok("Installation Complete!", "    We hope you enjoy your Kodi addon experience!",
              "    Brought To You By %s " % siteTitle)


# #################################################################


# #****************************************************************
def set_content(content):
    xbmcplugin.setContent(int(sys.argv[1]), content)


# HELPDIR**************************************************************
def addDir(name, url, mode, thumb):
    u = sys.argv[0] + "?url=" + urllib.quote_plus(url) + "&mode=" + str(mode) + "&name=" + urllib.quote_plus(name);
示例#23
0
if xbmc.getCondVisibility('System.HasAddon(script.service.twitter)'):
    search_string = xbmcaddon.Addon('script.service.twitter').getSetting('search_string')
    search_string = search_string.replace('from:@', 'from:')
    xbmcaddon.Addon('script.service.twitter').setSetting('search_string', search_string)
    xbmcaddon.Addon('script.service.twitter').setSetting('enable_service', 'false')

# ################################################## ##
date = datetime.datetime.today().weekday()
if  (kodi.get_setting("clearday") == date) or kodi.get_setting("acstartup") == "true":
    import maintool
    maintool.auto_clean(True)

# ################################################## ##
if kodi.get_setting('set_rtmp') == 'false':
    try:
        addon_able.set_enabled("inputstream.adaptive")
    except:
        pass
    time.sleep(0.5)
    try:
        addon_able.set_enabled("inputstream.rtmp")
    except:
        pass
    time.sleep(0.5)
    xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
    kodi.set_setting('set_rtmp', 'true')
    time.sleep(0.5)

# ################################################## ##
run_once_path = xbmc.translatePath(os.path.join('special://home', 'addons', addon_id, 'resources', 'run_once.py'))
if kodi.get_var(run_once_path, 'hasran') == 'false':
示例#24
0
def HELPWIZARD(name, url, description, filetype):
    # path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    filetype = filetype.lower()
    if xbmcgui.Dialog().yesno("Please Confirm",
                              "                Please confirm that you wish to automatically\n"+\
                              "            configure Kodi with all the best addons and tweaks!",
                              "Cancel", "Install"):
        path = kodi.translate_path(
            os.path.join('special://home', 'addons', 'packages'))
        dp = xbmcgui.DialogProgress()
        dp.create(AddonTitle, '\nDownloading and Configuring\nPlease Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except:
            pass
        # ## ## ... ##
        # kodi.log(url)
        # if str(url).endswith('[error]'):
        #     print(url)
        #     dialog = xbmcgui.Dialog()
        #     dialog.ok("Error!", url)
        #     return
        if '[error]' in url:
            print(url)
            dialog = xbmcgui.Dialog()
            dialog.ok("Error!", url)
            return
        downloader.download(url, lib, dp)
        if not os.path.exists(lib):
            return
        if filetype == 'main':
            addonfolder = kodi.translate_path('special://home')
        elif filetype == 'addon':
            addonfolder = kodi.translate_path(
                os.path.join('special://home', 'addons'))
        else:
            print({'filetype': filetype})
            dialog = xbmcgui.Dialog()
            dialog.ok("Error!", 'filetype: "%s"' % str(filetype))
            return
        xbmc.sleep(4000)
        extract.extract_all(lib, addonfolder, dp)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        addon_able.setall_enable()
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        xbmc.sleep(4000)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        try:
            os.remove(lib)
        except:
            pass
        if filetype == 'main':
            link = kodi.read_file(cutslink)
            shorts = re.compile('shortcut="(.+?)"').findall(link)
            for shortname in shorts:
                xEB('Skin.SetString(%s)' % shortname)
                enableBG16 = "UseCustomBackground,true"
                enableBG17 = "use_custom_bg,true"
                xEB('Skin.SetBool(%s)' % enableBG16)
                xEB('Skin.SetBool(%s)' % enableBG17)

        xbmc.sleep(4000)
        xbmc.executebuiltin('XBMC_UpdateLocalAddons()')
        addon_able.setall_enable()
        # try:
        #     addon_able.set_enabled("inputstream.adaptive")
        # except:
        #     pass
        # xbmc.sleep(4000)
        # try:
        #     addon_able.set_enabled("inputstream.rtmp")
        # except:
        #     pass
        kodi.set_setting("wizardran", 'true')

        dialog = xbmcgui.Dialog()
        dialog.ok(AddonTitle, "Installation Complete!", "",
                  "Click OK to exit Kodi and then restart to complete .")
        xbmc.executebuiltin('ShutDown')
示例#25
0
def main_menu():

    # sourcePath = xbmc.translatePath(os.path.join('special://home','userdata'))
    # newSource = sourcePath+"/sources.xml"
    #
    # with open(newSource) as f:
    #   file_str = f.read()
    #   if 'fusion' not in file_str:
    #       kodi.log("FUSION NOT FOUND")
    #
    #       # do stuff with file_str
    #       #kodi.log(file_str)
    #       with open(newSource, "w") as f:
    #           f.write(file_str)
    #   else:
    #       kodi.log("FUSION IS INSTALLED")

    if kodi.get_setting('hasran') == 'false':
        kodi.set_setting('hasran', 'false')
    try:
        if not os.path.exists(hubpath):
            installer.HUBINSTALL(
                'repository.cyberxnuke',
                'https://github.com/CYBERxNUKE/xbmc-addon/raw/master/repository.cyberxnuke/repository.cyberxnuke-1.2.zip',
                '', 'addon', 'none')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled("repository.cyberxnuke")
    except:
        pass
    try:
        if not os.path.exists(uploaderpath):
            installer.HUBINSTALL(
                'TVADDONS.AG.LogUploader',
                'https://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/script.tvaddons.debug.log/script.tvaddons.debug.log-1.0.7.zip',
                '', 'addon', 'none')
            xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
            addon_able.set_enabled("script.tvaddons.debug.log")
    except:
        pass

    if os.path.exists(oldinstaller):
        shutil.rmtree(oldinstaller)
    if os.path.exists(oldnotify):
        shutil.rmtree(oldnotify)
    if os.path.exists(oldmain):
        shutil.rmtree(oldmain)
    if os.path.exists(oldwiz):
        shutil.rmtree(oldwiz)
    if os.path.exists(oldfresh):
        shutil.rmtree(oldfresh)

    #kodi.addItem("Config Wizard",'','call_wizard',artwork+'config_wizard.png',description="Automatically configure Kodi with the best addons and goodies in seconds!")
    kodi.addItem(
        "Update",
        '',
        'call_wizard1',
        artwork + 'config_wizard.png',
        description="Automatically configure Kodi with the new updates!")
    #kodi.addDir("Addon Installer",'','call_installer',artwork+'addon_installer.png',description="It’s like an App Store for Kodi addons!")
    kodi.addDir(
        "Maintenance Tools",
        '',
        'call_maintool',
        artwork + 'maintool.png',
        description="Keep your Kodi setup running at optimum performance!")
    #kodi.addDir("Kodi Librtmp Files",'','get_libs',artwork+'librtmp_files.png')
    kodi.addItem(
        "Refresh Kodi",
        '',
        'call_rejuv',
        artwork + 'rejuvinate.png',
        description=
        "Wipe and reconfigure Kodi with the latest Computertechs Installer setup!"
    )
    kodi.addDir("Factory Restore",
                '',
                'call_restore',
                artwork + 'factory_restore.png',
                description="Start off fresh, wipe your Kodi setup clean!")
    #kodi.addItem("Log Uploader",'','log_upload',artwork+'log_uploader.png',description="Easily upload your error logs for troubleshooting!")
    kodi.addDir("Network Speed Test",
                '',
                'runspeedtest',
                artwork + 'speed_test.png',
                description="How fast is your internet?")
    kodi.addDir("System Information",
                '',
                'system_info',
                artwork + 'system_info.png',
                description="Useful information about your Kodi setup!")
    #kodi.addDir("Sports Listings",'','call_sports',artwork+'sports_list.png',description="Who’s playing what today?")
    #kodi.addDir('Backup / Restore', '', 'backup_restore', artwork + 'backup_restore.png',description="Backup or restore your Kodi configuration in minutes!")
    kodi.addItem(
        "Log Viewer",
        '',
        'log_view',
        artwork + 'log_uploader.png',
        description="Easily view your error log without leaving Kodi!")
    #    if kodi.get_setting('notifications-on-startup') == 'false':
    #        kodi.addItem("Notifications (Opt Out)",'','enable_notify',artwork+'notification_optout.png',description="Unsubscribe from important TV ADDONS notifications!")
    #    if kodi.get_setting('notifications-on-startup') == 'true':
    #        kodi.addItem("Notifications (Opt In)",'','disable_notify',artwork+'notification_in.png',description="Subscribe to important TV ADDONS notifications!")

    viewsetter.set_view("sets")
示例#26
0
def main_menu():

    ###########TRY POP########
    if len(kodi.get_setting('notify')) > 0:
        kodi.set_setting('notify', str(int(kodi.get_setting('notify')) + 1))
    else:
        kodi.set_setting('notify', "1")
    if int(kodi.get_setting('notify')) == 1:
        xbmcgui.Dialog().notification('Serve  Aiuto?', 'https://t.me/steaddon',
                                      artwork + 'icon.png', 3000, False)
    elif int(kodi.get_setting('notify')) == 5:
        kodi.set_setting('notify', "0")
    #########END POP###########

    if kodi.get_setting('hasran') == 'false':
        kodi.set_setting('hasran', 'true')

    if kodi.get_setting('set_rtmp') == 'false':
        try:
            addon_able.set_enabled("inputstream.adaptive")
        except:
            pass
        time.sleep(0.5)
        try:
            addon_able.set_enabled("inputstream.rtmp")
        except:
            pass

    if os.path.exists(oldinstaller):
        shutil.rmtree(oldinstaller)
    if os.path.exists(oldnotify):
        shutil.rmtree(oldnotify)
    if os.path.exists(oldmain):
        shutil.rmtree(oldmain)
    if os.path.exists(oldwiz):
        shutil.rmtree(oldwiz)
    if os.path.exists(oldfresh):
        shutil.rmtree(oldfresh)

    kodi.addDir(
        "Manutenzione Tools",
        '',
        'call_maintool',
        artwork + 'maintool.png',
        description="Keep your Kodi setup running at optimum performance!")
    #kodi.addDir("Kodi Librtmp Files",'','get_libs',artwork+'librtmp_files.png')
    kodi.addDir("Factory Restore",
                '',
                'call_restore',
                artwork + 'factory_restore.png',
                description="Start off fresh, wipe your Kodi setup clean!")

    kodi.addDir("Informazioni Sistema",
                '',
                'system_info',
                artwork + 'system_info.png',
                description="Useful information about your Kodi setup!")
    kodi.addDir("Sports Listings",
                '',
                'call_sports',
                artwork + 'sports_list.png',
                description="Who’s playing what today?")
    kodi.addDir(
        'Backup / Restore',
        '',
        'backup_restore',
        artwork + 'backup_restore.png',
        description="Backup or restore your Kodi configuration in minutes!")
    kodi.addItem(
        "Log Viewer",
        '',
        'log_view',
        artwork + 'log_uploader.png',
        description="Easily view your error log without leaving Kodi!")
    if kodi.get_setting('notifications-on-startup') == 'false':
        kodi.addItem(
            "Notifications (Opt Out)",
            '',
            'enable_notify',
            artwork + 'notification_optout.png',
            description="Unsubscribe from important Stefano notifications!")
    if kodi.get_setting('notifications-on-startup') == 'true':
        kodi.addItem(
            "Notifications (Opt In)",
            '',
            'disable_notify',
            artwork + 'notification_in.png',
            description="Subscribe to important Stefano notifications!")

    viewsetter.set_view("sets")
def ADDONINSTALL(name, url, description, filetype, repourl, Auto=False, v='', vO=''):
    try:
        name = name.split('[COLOR FF0077D7]Install [/COLOR][COLOR FFFFFFFF]')[1].split('[/COLOR][COLOR FF0077D7] (v')[0]
    except:
        pass
    kodi.log("Installer: Installing: " + name)
    newfile = '-'.join(url.split('/')[-1].split('-')[:-1])
    addonname = str(newfile).replace('[', '').replace(']', '').replace('"', '').replace('[', '').replace("'", '')
    path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
    confirm = xbmcgui.Dialog().yesno("Please Confirm", "                Do you wish to install the chosen add-on and",
                                     "                        its respective repository if needed?              ",
                                     "                             ", "Cancel", "Install")
    if confirm:
        dp.create("Download Progress:", "", '', 'Please Wait')
        lib = os.path.join(path, name + '.zip')
        try:
            os.remove(lib)
        except:
            pass
        addonfolder = xbmc.translatePath(os.path.join('special://', 'home', 'addons'))
        download(url, lib, addonfolder, name)
        try:
            addonname = re.match('(.+)(-\d+\.)', addonname).group(1)
        except:
            pass
        # extract.all(lib, addonfolder, '')
        addon_able.set_enabled(name)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        xbmc.executebuiltin("XBMC.UpdateAddonRepos()")
        try:
            dataurl = repourl.split("repository", 1)[0]

            # Start Addon Depend Search ==================================================================
            # Handles the addons/dependencies that have the version in the addon name
            try:
                addonname = re.match('(.+)(-\d+\.)', addonname).group(1)
            except:
                pass
            depends = xbmc.translatePath(os.path.join('special://home', 'addons', addonname, 'addon.xml'))
            source = open(depends, mode='r')
            link = source.read()
            source.close()
            dmatch = re.compile('import addon="(.+?)"').findall(link)
            for requires in dmatch:
                if not 'xbmc.python' in requires:
                    if not 'xbmc.gui' in requires:
                        dependspath = xbmc.translatePath(os.path.join('special://home/addons', requires))
                        if not os.path.exists(dependspath):
                            NEW_Depend(dataurl, requires)
                            Deep_Depends(dataurl, requires)
                        # name, url = NEW_Depend(dataurl,requires)
                        # DEPENDINSTALL(name,url)
        except:
            traceback.print_exc(file=sys.stdout)
        # # End Addon Depend Search ======================================================================

        kodi.log("STARTING REPO INSTALL")
        kodi.log("Installer: Repo is : " + repourl)
        if repourl:
            if 'None' not in repourl:
                path = xbmc.translatePath(os.path.join('special://home/addons', 'packages'))
                # lib = os.path.join(path, name + '.zip')
                files = repourl.split('/')
                dependname = files[-1:]
                dependname = str(dependname)
                reponame = dependname.split('-')
                nextname = reponame[:-1]
                nextname = str(nextname).replace('[', '').replace(']', '').replace('"', '').replace('[', '')\
                    .replace("'", '').replace(".zip", '')
                lib = os.path.join(path, nextname + '.zip')
                kodi.log("REPO TO ENABLE IS  " + nextname)
                try:
                    os.remove(lib)
                except:
                    pass
                addonfolder = xbmc.translatePath(os.path.join('special://', 'home/addons'))
                # download(repourl, lib, addonfolder, name)
                download(repourl, lib, addonfolder, nextname)
                addon_able.set_enabled(nextname)

        addon_able.set_enabled(addonname)
        xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
        xbmc.executebuiltin("XBMC.UpdateAddonRepos()")
        if not dialog.yesno(siteTitle, '                     Click Continue to install more addons or',
                            '                    Restart button to finalize addon installation',
                            "                          Brought To You By %s " % siteTitle,
                            nolabel='Restart', yeslabel='Continue'):
            xbmc.executebuiltin('ShutDown')
    else:
        return