コード例 #1
0
    def install_addon_from_url(self, plugin, url):
        from resources.libs.downloader import Downloader
        from resources.libs import db
        from resources.libs import extract
        from resources.libs import skin

        response = tools.open_url(url, check=True)

        if not response:
            logging.log_notify("[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
                               '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Invalid Zip Url![/COLOR]'.format(CONFIG.COLOR1,
                                                                                                    plugin,
                                                                                                    CONFIG.COLOR2))
            return

        tools.ensure_folders(CONFIG.PACKAGES)

        self.progress_dialog.create(CONFIG.ADDONTITLE,
                               '[COLOR {0}][B]Downloading:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2,
                                                                                                      CONFIG.COLOR1,
                                                                                                      plugin)
                               +'\n'+''
                               +'\n'+'[COLOR {0}]Please Wait[/COLOR]'.format(CONFIG.COLOR2))
        urlsplits = url.split('/')
        lib = os.path.join(CONFIG.PACKAGES, urlsplits[-1])

        try:
            os.remove(lib)
        except:
            pass
            
        Downloader().download(url, lib)
        title = '[COLOR {0}][B]Installing:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1,
                                                                                      plugin)
        self.progress_dialog.update(0, title
                                    +'\n'+''
                                    +'\n'+'[COLOR {0}]Please Wait[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
        self.progress_dialog.update(0, title
                                    +'\n'+''
                                    +'\n'+'[COLOR {0}]Installing Dependencies[/COLOR]'.format(CONFIG.COLOR2))
        installed(plugin)
        installlist = db.grab_addons(lib)
        logging.log(str(installlist))
        db.addon_database(installlist, 1, True)
        self.install_dependency(plugin)
        self.progress_dialog.close()

        xbmc.executebuiltin('UpdateAddonRepos()')
        xbmc.executebuiltin('UpdateLocalAddons()')
        xbmc.executebuiltin('Container.Refresh()')

        for item in installlist:
            if item.startswith('skin.') and not item == 'skin.shortcuts':
                if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                    CONFIG.set_setting('defaultskinignore', 'true')
                skin.switch_to_skin(item, 'Skin Installer')
コード例 #2
0
    def __init__(self):
        tools.ensure_folders(CONFIG.PACKAGES)

        self.dialog = xbmcgui.Dialog()
        self.dialogProgress = xbmcgui.DialogProgress()
コード例 #3
0
def auto_install_repo():
    if not os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        response = tools.open_url(CONFIG.REPOADDONXML)

        if response:
            from xml.etree import ElementTree
            
            root = ElementTree.fromstring(response.text)
            repoaddon = root.findall('addon')
            repoversion = [tag.get('version') for tag in repoaddon if tag.get('id') == CONFIG.REPOID]
            
            if repoversion:
                installzip = '{0}-{1}.zip'.format(CONFIG.REPOID, repoversion[0])
                url = CONFIG.REPOZIPURL + installzip
                repo_response = tools.open_url(url, check=True)

                if repo_response:
                    progress_dialog = xbmcgui.DialogProgress()
                    
                    progress_dialog.create(CONFIG.ADDONTITLE, 'Downloading Repo...' + '\n' + 'Please Wait')
                    tools.ensure_folders(CONFIG.PACKAGES)
                    lib = os.path.join(CONFIG.PACKAGES, installzip)

                    # Remove the old zip if there is one
                    tools.remove_file(lib)

                    from resources.libs.downloader import Downloader
                    from resources.libs import extract
                    Downloader().download(url, lib)
                    extract.all(lib, CONFIG.ADDONS)

                    try:
                        repoxml = os.path.join(CONFIG.ADDONS, CONFIG.REPOID, 'addon.xml')
                        root = ElementTree.parse(repoxml).getroot()
                        reponame = root.get('name')
                        
                        logging.log_notify("{1}".format(CONFIG.COLOR1, reponame),
                                           "[COLOR {0}]Add-on updated[/COLOR]".format(CONFIG.COLOR2),
                                           icon=os.path.join(CONFIG.ADDONS, CONFIG.REPOID, 'icon.png'))
                                           
                    except Exception as e:
                        logging.log(str(e), level=xbmc.LOGERROR)

                    # Add wizard to add-on database
                    db.addon_database(CONFIG.REPOID, 1)

                    progress_dialog.close()
                    xbmc.sleep(500)

                    logging.log("[Auto Install Repo] Successfully Installed", level=xbmc.LOGINFO)
                else:
                    logging.log_notify("[COLOR {0}]Repo Install Error[/COLOR]".format(CONFIG.COLOR1),
                                       "[COLOR {0}]Invalid URL for zip![/COLOR]".format(CONFIG.COLOR2))
                    logging.log("[Auto Install Repo] Was unable to create a working URL for repository. {0}".format(
                        url), level=xbmc.LOGERROR)
            else:
                logging.log("Invalid URL for Repo zip", level=xbmc.LOGERROR)
        else:
            logging.log_notify("[COLOR {0}]Repo Install Error[/COLOR]".format(CONFIG.COLOR1),
                               "[COLOR {0}]Invalid addon.xml file![/COLOR]".format(CONFIG.COLOR2))
            logging.log("[Auto Install Repo] Unable to read the addon.xml file.", level=xbmc.LOGERROR)
    elif not CONFIG.AUTOINSTALL == 'Yes':
        logging.log("[Auto Install Repo] Not Enabled", level=xbmc.LOGINFO)
    elif os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        logging.log("[Auto Install Repo] Repository already installed")
コード例 #4
0
    if not CONFIG.get_setting('time_started') == NOW:
        logging.log('Killing Start Up Script')
        sys.exit()
    else:
        logging.log('Continuing Start Up Script')


def check_for_video():
    while xbmc.Player().isPlayingVideo():
        xbmc.sleep(1000)


# Don't run the script while video is playing :)
check_for_video()
# Ensure that any needed folders are created
tools.ensure_folders()
# Stop this script if it's been run more than once
# if CONFIG.KODIV < 18:
    # stop_if_duplicate()
# Ensure that the wizard's name matches its folder
check.check_paths()


# FIRST RUN SETTINGS
if CONFIG.get_setting('first_install') == 'true':
    logging.log("[First Run] Showing Save Data Settings", level=xbmc.LOGINFO)
    window.show_save_data_settings()
else:
    logging.log("[First Run] Skipping Save Data Settings", level=xbmc.LOGINFO)

# BUILD INSTALL PROMPT
コード例 #5
0
 def __init__(self):
     self.route = None
     self.params = {}
     tools.ensure_folders()
コード例 #6
0
    def __init__(self, external=False):
        tools.ensure_folders()

        self.external = external
        self.dialog = xbmcgui.Dialog()
        self.progress_dialog = xbmcgui.DialogProgress()
コード例 #7
0
    def __init__(self):
        from resources.libs.common import tools
        tools.ensure_folders()

        self.external = False
        self.location = 'Local'
コード例 #8
0
 def install_addon_from_url(self, plugin, url):
     from resources.libs.downloader import Downloader
     from resources.libs import db
     from resources.libs import extract
     from resources.libs import skin
     if 50 - 50: I1IiiI
     oo0Ooo0 = tools.open_url(url, check=True)
     if 34 - 34: I1IiiI * II111iiii % o0OO0 * OoOoOO00 - I1IiiI
     if not oo0Ooo0:
         logging.log_notify(
             "[COLOR {0}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
             '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Invalid Zip Url![/COLOR]'.
             format(CONFIG.COLOR1, plugin, CONFIG.COLOR2))
         return
         if 33 - 33: o0oOOo0O0Ooo + OOooOOo * OoO0O00 - Oo0Ooo / oO0o % Ii1I
     tools.ensure_folders(CONFIG.PACKAGES)
     if 21 - 21: OoO0O00 * iIii1I11I1II1 % oO0o * i1IIi
     self.progress_dialog.create(
         CONFIG.ADDONTITLE,
         '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
         format(CONFIG.COLOR2, CONFIG.COLOR1, plugin) + '\n' + '' + '\n' +
         '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
     Ii11Ii1I = url.split('/')
     O00oO = os.path.join(CONFIG.PACKAGES, Ii11Ii1I[-1])
     if 39 - 39:
         Oo0ooO0oo0oO - II111iiii * OoO0O00 % o0oOOo0O0Ooo * II111iiii % II111iiii
     try:
         os.remove(O00oO)
     except:
         pass
         if 59 - 59:
             iIii1I11I1II1 + I1IiiI - o0oOOo0O0Ooo - I1IiiI + OOooOOo / I1ii11iIi11i
     Downloader().download(url, O00oO)
     I1 = '[COLOR {0}][B]Baixando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
         CONFIG.COLOR2, CONFIG.COLOR1, plugin)
     self.progress_dialog.update(
         0, I1 + '\n' + '' + '\n' +
         '[COLOR {0}]Por favor, aguarde[/COLOR]'.format(CONFIG.COLOR2))
     OO00Oo, O0OOO0OOoO0O, O00Oo000ooO0 = extract.all(O00oO,
                                                      CONFIG.ADDONS,
                                                      title=I1)
     self.progress_dialog.update(
         0, I1 + '\n' + '' + '\n' +
         '[COLOR {0}]Baixando Dependencies[/COLOR]'.format(CONFIG.COLOR2))
     IiiIII111iI(plugin)
     OoO0O00IIiII = db.grab_addons(O00oO)
     logging.log(str(OoO0O00IIiII))
     db.addon_database(OoO0O00IIiII, 1, True)
     self.install_dependency(plugin)
     self.progress_dialog.close()
     if 80 - 80: Oo0ooO0oo0oO.oO0o
     xbmc.executebuiltin('UpdateAddonRepos()')
     xbmc.executebuiltin('UpdateLocalAddons()')
     xbmc.executebuiltin('Container.Refresh()')
     if 25 - 25: OoOoOO00.II111iiii / o0OO0.OOooOOo * OoO0O00.I1IiiI
     for Oo0oOOo in OoO0O00IIiII:
         if Oo0oOOo.startswith('skin.') and not Oo0oOOo == 'skin.shortcuts':
             if not CONFIG.BUILDNAME == '' and CONFIG.DEFAULTIGNORE == 'true':
                 CONFIG.set_setting('defaultskinignore', 'true')
             skin.switch_to_skin(Oo0oOOo, 'Skin Installer')
             if 58 - 58: II111iiii * OOooOOo * I1ii11iIi11i / OOooOOo
コード例 #9
0
def auto_install_repo():
    if not os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        response = tools.open_url(CONFIG.REPOADDONXML)

        if response:
            from xml.etree import ElementTree

            root = ElementTree.fromstring(response.text)
            repoaddon = root.findall('addon')
            repoversion = [
                tag.get('version') for tag in repoaddon
                if tag.get('id') == CONFIG.REPOID
            ]

            if repoversion:
                installzip = '{0}-{1}.zip'.format(CONFIG.REPOID,
                                                  repoversion[0])
                url = CONFIG.REPOZIPURL + installzip
                repo_response = tools.open_url(url, check=True)

                if repo_response:
                    progress_dialog = xbmcgui.DialogProgress()

                    progress_dialog.create(
                        CONFIG.ADDONTITLE,
                        'Descargando Repo...' + '\n' + 'Espere por favor')
                    tools.ensure_folders(CONFIG.PACKAGES)
                    lib = os.path.join(CONFIG.PACKAGES, installzip)

                    # Remove the old zip if there is one
                    tools.remove_file(lib)

                    from resources.libs.downloader import Downloader
                    from resources.libs import extract
                    Downloader().download(url, lib)
                    extract.all(lib, CONFIG.ADDONS)

                    try:
                        repoxml = os.path.join(CONFIG.ADDONS, CONFIG.REPOID,
                                               'addon.xml')
                        root = ElementTree.parse(repoxml).getroot()
                        reponame = root.get('name')

                        logging.log_notify(
                            "{1}".format(CONFIG.COLOR1, reponame),
                            "[COLOR {0}]Add-on actualizado[/COLOR]".format(
                                CONFIG.COLOR2),
                            icon=os.path.join(CONFIG.ADDONS, CONFIG.REPOID,
                                              'icon.png'))

                    except Exception as e:
                        logging.log(str(e), level=xbmc.LOGERROR)

                    # Add wizard to add-on database
                    db.addon_database(CONFIG.REPOID, 1)

                    progress_dialog.close()
                    xbmc.sleep(500)

                    logging.log("[Auto Install Repo] Instalado exitosamente",
                                level=xbmc.LOGINFO)
                else:
                    logging.log_notify(
                        "[COLOR {0}]Error de instalación del repositorio[/COLOR]"
                        .format(CONFIG.COLOR1),
                        "[COLOR {0}]URL no válida para zip.[/COLOR]".format(
                            CONFIG.COLOR2))
                    logging.log(
                        "[Auto Install Repo] No se pudo crear una URL funcional para el repositorio.. {0}"
                        .format(url),
                        level=xbmc.LOGERROR)
            else:
                logging.log("URL no válida para el zip del repositorio",
                            level=xbmc.LOGERROR)
        else:
            logging.log_notify(
                "[COLOR {0}]Error de instalación del repositorio[/COLOR]".
                format(CONFIG.COLOR1),
                "[COLOR {0}]Archivo addon.xml no válido![/COLOR]".format(
                    CONFIG.COLOR2))
            logging.log(
                "[Auto Install Repo] No se puede leer el archivo addon.xml.",
                level=xbmc.LOGERROR)
    elif not CONFIG.AUTOINSTALL == 'Yes':
        logging.log("[Auto Install Repo] No habilitado", level=xbmc.LOGINFO)
    elif os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        logging.log("[Auto Install Repo] Repositorio ya instalado")
コード例 #10
0
def auto_install_repo():
    if not os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        response = tools.open_url(CONFIG.REPOADDONXML)

        if response:
            ver = tools.parse_dom(response.text,
                                  'addon',
                                  ret='version',
                                  attrs={'id': CONFIG.REPOID})
            if len(ver) > 0:
                installzip = '{0}-{1}.zip'.format(CONFIG.REPOID, ver[0])
                repo_response = tools.open_url(CONFIG.REPOZIPURL + installzip)

                if repo_response:
                    progress_dialog = xbmcgui.DialogProgress()

                    progress_dialog.create(CONFIG.ADDONTITLE,
                                           'Downloading Repo...', '',
                                           'Please Wait')
                    tools.ensure_folders(CONFIG.PACKAGES)
                    lib = os.path.join(CONFIG.PACKAGES, installzip)

                    # Remove the old zip if there is one
                    tools.remove_file(lib)

                    from resources.libs.downloader import Downloader
                    from resources.libs import extract
                    Downloader().download(CONFIG.REPOZIPURL + installzip, lib)
                    extract.all(lib, CONFIG.ADDONS)

                    try:
                        repoxml = os.path.join(CONFIG.ADDONS, CONFIG.REPOID,
                                               'addon.xml')
                        name = tools.parse_dom(tools.read_from_file(repoxml),
                                               'addon',
                                               ret='name',
                                               attrs={'id': CONFIG.REPOID})
                        logging.log_notify(
                            "[COLOR {0}]{1}[/COLOR]".format(
                                CONFIG.COLOR1, name[0]),
                            "[COLOR {0}]Add-on updated[/COLOR]".format(
                                CONFIG.COLOR2),
                            icon=os.path.join(CONFIG.ADDONS, CONFIG.REPOID,
                                              'icon.png'))
                    except Exception as e:
                        logging.log(str(e), level=xbmc.LOGERROR)

                    # Add wizard to add-on database
                    db.addon_database(CONFIG.REPOID, 1)

                    progress_dialog.close()
                    xbmc.sleep(500)

                    logging.log("[Auto Install Repo] Successfully Installed",
                                level=xbmc.LOGNOTICE)
                else:
                    logging.log_notify(
                        "[COLOR {0}]Repo Install Error[/COLOR]".format(
                            CONFIG.COLOR1),
                        "[COLOR {0}]Invalid URL for zip![/COLOR]".format(
                            CONFIG.COLOR2))
                    logging.log(
                        "[Auto Install Repo] Was unable to create a working URL for repository. {0}"
                        .format(repo_response.text),
                        level=xbmc.LOGERROR)
            else:
                logging.log("Invalid URL for Repo zip", level=xbmc.LOGERROR)
        else:
            logging.log_notify(
                "[COLOR {0}]Repo Install Error[/COLOR]".format(CONFIG.COLOR1),
                "[COLOR {0}]Invalid addon.xml file![/COLOR]".format(
                    CONFIG.COLOR2))
            logging.log(
                "[Auto Install Repo] Unable to read the addon.xml file.",
                level=xbmc.LOGERROR)
    elif not CONFIG.AUTOINSTALL == 'Yes':
        logging.log("[Auto Install Repo] Not Enabled", level=xbmc.LOGNOTICE)
    elif os.path.exists(os.path.join(CONFIG.ADDONS, CONFIG.REPOID)):
        logging.log("[Auto Install Repo] Repository already installed")