Ejemplo n.º 1
0
def youtube_menu(url=None):
    from resources.libs.common import logging
    from resources.libs.common import tools

    response = tools.open_url(CONFIG.YOUTUBEFILE)
    url_response = tools.open_url(url)

    if response:
        TEMPYOUTUBEFILE = url_response.text if url else response.text

        if TEMPYOUTUBEFILE:
            link = TEMPYOUTUBEFILE.replace('\n', '').replace('\r', '').replace('\t', '')
            match = re.compile('name="(.+?)".+?ection="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?escription="(.+?)"').findall(link)
            if len(match) > 0:
                for name, section, url, icon, fanart, description in match:
                    if section.lower() == "yes":
                        directory.add_dir("[B]{0}[/B]".format(name), {'mode': 'youtube', 'name': name, 'url': url}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
                    else:
                        directory.add_file(name, {'mode': 'viewVideo', 'url': url}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
            else:
                logging.log("[YouTube Menu] ERROR: Invalid Format.")
        else:
            logging.log("[YouTube Menu] ERROR: URL for YouTube list not working.")
            directory.add_file('Url for txt file not valid', themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.YOUTUBEFILE), themeit=CONFIG.THEME3)
    else:
        logging.log("[YouTube Menu] No YouTube list added.")
    def build_info(self, name):
        from resources.libs import check
        from resources.libs.common import logging
        from resources.libs.common import tools
        from resources.libs.gui import window
        
        response = tools.open_url(CONFIG.BUILDFILE, check=True)
        
        if response:
            if check.check_build(name, 'url'):
                name, version, url, minor, gui_ignore, kodi, theme, icon, fanart, preview, adult, info, description = check.check_build(name, 'all')
                adult = 'Yes' if adult.lower() == 'yes' else 'No'

                info_response = tools.open_url(info)

                if info_response:
                    try:
                        tname, extracted, zipsize, skin, created, programs, video, music, picture, repos, scripts, binaries = check.check_info(info_response.text)
                        extend = True
                    except:
                        extend = False
                else:
                    extend = False

                themes = self.theme_count(name, count=False)

                msg = "[COLOR {0}]Build Name:[/COLOR] [COLOR {1}]{2}[/COLOR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, name)
                msg += "[COLOR {0}]Build Version:[/COLOR] [COLOR {1}]{2}[/COLOR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, version)
                if themes:
                    msg += "[COLOR {0}]Build Theme(s):[/COLOR] [COLOR {1}]{2}[/COLOR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, ', '.join(themes))
                msg += "[COLOR {0}]Kodi Version:[/COLOR] [COLOR {1}]{2}[/COLOR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, kodi)
                msg += "[COLOR {0}]Adult Content:[/COLOR] [COLOR {1}]{2}[/COLOR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, adult)
                msg += "[COLOR {0}]Description:[/COLOR] [COLOR {1}]{2}[/COLOR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, description)

                if extend:
                    msg += "[COLOR {0}]Latest Update:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, created)
                    msg += "[COLOR {0}]Extracted Size:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, tools.convert_size(int(float(extracted))))
                    msg += "[COLOR {0}]Zip Size:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, tools.convert_size(int(float(zipsize))))
                    msg += "[COLOR {0}]Skin Name:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, skin)
                    msg += "[COLOR {0}]Programs:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, programs)
                    msg += "[COLOR {0}]Video:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, video)
                    msg += "[COLOR {0}]Music:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, music)
                    msg += "[COLOR {0}]Pictures:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, picture)
                    msg += "[COLOR {0}]Repositories:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, repos)
                    msg += "[COLOR {0}]Scripts:[/COLOR] [COLOR {1}]{2}[/COLOR][CR][CR]".format(CONFIG.COLOR2, CONFIG.COLOR1, scripts)
                    msg += "[COLOR {0}]Binaries:[/COLOR] [COLOR {1}]{2}[/COLOR]".format(CONFIG.COLOR2, CONFIG.COLOR1, binaries)

                window.show_text_box("Viewing Build Info: {0}".format(name), msg)
            else:
                logging.log("Invalid Build Name!")
        else:
            logging.log("Build text file not working: {0}".format(CONFIG.BUILDFILE))
Ejemplo n.º 3
0
def addon_menu(url=None):
    from resources.libs.common import logging
    from resources.libs.common import tools

    response = tools.open_url(CONFIG.ADDONFILE)
    url_response = tools.open_url(url)

    if response:
        TEMPADDONFILE = url_response.text if url else response.text

        if TEMPADDONFILE:
            link = TEMPADDONFILE.replace('\n', '').replace('\r', '').replace('\t', '').replace('repository=""', 'repository="none"').replace('repositoryurl=""', 'repositoryurl="http://"').replace('repositoryxml=""', 'repositoryxml="http://"')
            match = re.compile('name="(.+?)".+?lugin="(.+?)".+?rl="(.+?)".+?epository="(.+?)".+?epositoryxml="(.+?)".+?epositoryurl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"').findall(link)
            if len(match) > 0:
                x = 0
                for aname, plugin, aurl, repository, repositoryxml, repositoryurl, icon, fanart, adult, description in match:
                    if plugin.lower() == 'section':
                        x += 1
                        directory.add_dir("[B]{0}[/B]".format(aname), {'mode': 'addons', 'name': aname, 'url': aurl}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME3)
                    elif plugin.lower() == 'skin':
                        if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                            continue
                        x += 1
                        directory.add_file("[B]{0}[/B]".format(aname), {'mode': 'skinpack', 'name': aname, 'url': aurl}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
                    elif plugin.lower() == 'pack':
                        if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                            continue
                        x += 1
                        directory.add_file("[B]{0}[/B]".format(aname), {'mode': 'addonpack', 'name': aname, 'url': aurl}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
                    else:
                        if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                            continue
                        try:
                            add = xbmcaddon.Addon(id=plugin).getAddonInfo('path')
                            if os.path.exists(add):
                                aname = "[COLOR springgreen][Installed][/COLOR] {0}".format(aname)
                        except:
                            pass
                        x += 1
                        directory.add_file(aname, {'mode': 'addoninstall', 'name': plugin, 'url': url}, description=description, icon=icon, fanart=fanart, themeit=CONFIG.THEME2)
                    if x < 1:
                        directory.add_file("No addons added to this menu yet!", themeit=CONFIG.THEME2)
            else:
                directory.add_file('Text File not formated correctly!', themeit=CONFIG.THEME3)
                logging.log("[Addon Menu] ERROR: Invalid Format.")
        else:
            logging.log("[Addon Menu] ERROR: URL for Addon list not working.")
            directory.add_file('Url for txt file not valid', themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.ADDONFILE), themeit=CONFIG.THEME3)
    else:
        logging.log("[Addon Menu] No Addon list added.")
 def build_video(self, name):
     from resources.libs import check
     from resources.libs import yt
     from resources.libs.common import logging
     from resources.libs.common import tools
     
     response = tools.open_url(CONFIG.BUILDFILE, check=True)
     
     if response:
         videofile = check.check_build(name, 'preview')
         if tools.open_url(videofile, check=True):
             yt.play_video(videofile)
         else:
             logging.log("[{0}]Unable to find url for video preview".format(name))
     else:
         logging.log("Build text file not working: {0}".format(CONFIG.BUILDFILE))
Ejemplo n.º 5
0
def show_notification():
    if not CONFIG.NOTIFY == 'true':
        response = tools.open_url(CONFIG.NOTIFICATION)
        if response:
            note_id, msg = window.split_notify(CONFIG.NOTIFICATION)
            if note_id:
                try:
                    note_id = int(note_id)
                    if note_id == CONFIG.NOTEID:
                        if CONFIG.NOTEDISMISS == 'false':
                            window.show_notification(msg)
                        else:
                            logging.log("[Notifications] id[{0}] Dismissed".format(int(id)), level=xbmc.LOGNOTICE)
                    elif note_id > CONFIG.NOTEID:
                        logging.log("[Notifications] id: {0}".format(str(id)), level=xbmc.LOGNOTICE)
                        CONFIG.set_setting('noteid', str(id))
                        CONFIG.set_setting('notedismiss', 'false')
                        window.show_notification(msg=msg)
                        logging.log("[Notifications] Complete", level=xbmc.LOGNOTICE)
                except Exception as e:
                    logging.log("Error on Notifications Window: {0}".format(str(e)), level=xbmc.LOGERROR)
            else:
                logging.log("[Notifications] Text File not formatted Correctly")
        else:
            logging.log("[Notifications] URL({0}): {1}".format(CONFIG.NOTIFICATION, response), level=xbmc.LOGNOTICE)
    else:
        logging.log("[Notifications] Turned Off", level=xbmc.LOGNOTICE)
Ejemplo n.º 6
0
def create_code():
    from resources.libs.common import tools

    dialog = xbmcgui.Dialog()

    url = tools.get_keyboard(
        '', "{0}: Inserte la URL del Código QR.".format(CONFIG.ADDONTITLE))
    response = tools.open_url(url, check=True)

    if not response:
        if not dialog.yesno(
                CONFIG.ADDONTITLE,
                "[COLOR {0}]Parece que la URL que ingresó no es válida o no funciona. Le gustaría crearla de todos modos?[/COLOR]"
                .format(CONFIG.COLOR2) + '\n' +
                "[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, url),
                yeslabel="[B][COLOR red]Sí, Crear[/COLOR][/B]",
                nolabel="[B][COLOR springgreen]No, Cancelar[/COLOR][/B]"):
            return
    name = tools.get_keyboard(
        '', "{0}: Inserte el nombre del Código QR.".format(CONFIG.ADDONTITLE))
    name = "QR_Code_{0}".format(tools.id_generator(6)) if name == "" else name
    image = generate_code(url, name)
    dialog.ok(
        CONFIG.ADDONTITLE,
        "[COLOR {0}]La imagen del Código QR se ha creado y se encuentra en el directorio addon_data:[/COLOR]"
        .format(CONFIG.COLOR2) + '\n' + "[COLOR {0}]{1}[/COLOR]".format(
            CONFIG.COLOR1, image.replace(CONFIG.HOME, '')))
Ejemplo n.º 7
0
def wizard_update(startup=None):
    from resources.libs import check
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    dialog = xbmcgui.Dialog()
    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if response:
        try:
            wid, ver, zip = check.check_wizard('all')
        except:
            return
        if ver > CONFIG.ADDON_VERSION:
            yes = dialog.yesno(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]There is a new version of the [COLOR {1}]{2}[/COLOR]!'.format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   'Would you like to download [COLOR {0}]v{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, ver),
                                   nolabel='[B][COLOR red]Remind Me Later[/COLOR][/B]',
                                   yeslabel="[B][COLOR springgreen]Update Wizard[/COLOR][/B]")
            if yes:
                from resources.libs.common import tools

                logging.log("[Auto Update Wizard] Installing wizard v{0}".format(ver))
                progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Downloading Update...'.format(CONFIG.COLOR2), '',
                              'Please Wait[/COLOR]')
                lib = os.path.join(CONFIG.PACKAGES, '{0}-{1}.zip'.format(CONFIG.ADDON_ID, ver))
                try:
                    os.remove(lib)
                except:
                    pass
                from resources.libs.downloader import Downloader
                from resources.libs import extract
                Downloader().download(zip, lib)
                xbmc.sleep(2000)
                progress_dialog.update(0, "", "Installing {0} update".format(CONFIG.ADDONTITLE))
                percent, errors, error = extract.all(lib, CONFIG.ADDONS, True)
                progress_dialog.close()
                xbmc.sleep(1000)
                force_update()
                xbmc.sleep(1000)
                logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   '[COLOR {0}]Add-on updated[/COLOR]'.format(CONFIG.COLOR2))
                logging.log("[Auto Update Wizard] Wizard updated to v{0}".format(ver))
                tools.remove_file(os.path.join(CONFIG.ADDONDATA, 'settings.xml'))
                window.show_save_data_settings()
                if startup:
                    xbmc.executebuiltin('RunScript({0}/startup.py)'.format(CONFIG.PLUGIN))
                return
            else:
                logging.log("[Auto Update Wizard] Install New Wizard Ignored: {0}".format(ver))
        else:
            if not startup:
                logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   "[COLOR {0}]No New Version of Wizard[/COLOR]".format(CONFIG.COLOR2))
            logging.log("[Auto Update Wizard] No New Version v{0}".format(ver))
    else:
        logging.log("[Auto Update Wizard] Url for wizard file not valid: {0}".format(CONFIG.BUILDFILE))
Ejemplo n.º 8
0
def build_count():
    from resources.libs import test
    from resources.libs.common import tools

    response = tools.open_url(CONFIG.BUILDFILE)

    total = 0
    count17 = 0
    count18 = 0
    hidden = 0
    adultcount = 0

    if not response:
        return total, count17, count18, adultcount, hidden

    link = response.text.replace('\n', '').replace('\r', '').replace('\t', '')
    match = re.compile('name="(.+?)".+?odi="(.+?)".+?dult="(.+?)"').findall(
        link)

    if len(match) > 0:
        for name, kodi, adult in match:
            if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                hidden += 1
                adultcount += 1
                continue
            if not CONFIG.DEVELOPER == 'true' and test.str_test(name):
                hidden += 1
                continue
            kodi = int(float(kodi))
            total += 1
            if kodi == 18:
                count18 += 1
            elif kodi == 17:
                count17 += 1
    return total, count17, count18, adultcount, hidden
Ejemplo n.º 9
0
 def theme_count(self, name, count=True):
     from resources.libs import check
     from resources.libs.common import tools
     if 27 - 27: OoO0O00
     oOOOo0o0O = check.check_build(name, 'theme')
     if 72 - 72: Oo0Ooo % OOooOOo.I1IiiI / I11i * I1IiiI
     iiiI11 = tools.open_url(oOOOo0o0O)
     if 91 - 91: o0oOOo0O0Ooo / II111iiii.I1ii11iIi11i + OOooOOo
     if not iiiI11:
         return False
         if 47 - 47: OoOoOO00 / Ii1I * OoooooooOO
     II111iiiiII = iiiI11.text
     oOoOo00oOo = tools.clean_text(II111iiiiII)
     Oo = re.compile('name="(.+?)"').findall(oOoOo00oOo)
     if 85 - 85: OOooOOo % I1ii11iIi11i * Oo0ooO0oo0oO
     if len(Oo) == 0:
         return False
         if 90 - 90: o0oOOo0O0Ooo % o0oOOo0O0Ooo % I11i * OoOoOO00
     i1IIiiiii = []
     for o00o in Oo:
         i1IIiiiii.append(o00o)
         if 41 - 41: i1IIi + O0oo0OO0 + OOooOOo - O00oOoOoO0o0O
     if len(i1IIiiiii) > 0:
         if count:
             return len(i1IIiiiii)
         else:
             return i1IIiiiii
     else:
         return False
         if 77 - 77: Oo0Ooo.O00oOoOoO0o0O % Oo0ooO0oo0oO
Ejemplo n.º 10
0
def i1ii1I1I1(notify):
    oOoO0O0o0Oooo = tools.open_url(notify)
    if 5 - 5: ooOoO0o - II111iiii - OoooooooOO % Ii1I + I1IiiI * iIii1I11I1II1
    if oOoO0O0o0Oooo:
        I1I1II1I11 = oOoO0O0o0Oooo.text
        if 8 - 8: o0oOOo0O0Ooo % O0 / I1IiiI - oO0o
        try:
            I1I1II1I11 = oOoO0O0o0Oooo.text.decode('utf-8')
        except:
            pass
            if 43 - 43: i11iIiiIii + Oo0Ooo * II111iiii * I1Ii111 * O0
        I1I1II1I11 = I1I1II1I11.replace('\r', '').replace('\t',
                                                          '    ').replace(
                                                              '\n', '[CR]')
        if I1I1II1I11.find('|||') == -1:
            return False, False
            if 64 - 64: OOooOOo % iIii1I11I1II1 * oO0o
        o0, iI11I1II = I1I1II1I11.split('|||')
        o0 = o0.replace('[CR]', '')
        if iI11I1II.startswith('[CR]'):
            iI11I1II = iI11I1II[4:]
            if 40 - 40: iIii1I11I1II1 / OoOoOO00 % I1ii11iIi11i + II111iiii
        return o0, iI11I1II
    else:
        return False, False
        if 27 - 27: II111iiii * OoOoOO00 * iIii1I11I1II1
        if 86 - 86: OoO0O00 * OOooOOo.iII111i
Ejemplo n.º 11
0
    def theme_count(self, name, count=True):
        from resources.libs import check
        from resources.libs.common import tools

        themefile = check.check_build(name, 'theme')

        response = tools.open_url(themefile)

        if not response:
            return False

        themetext = response.text
        link = tools.clean_text(themetext)
        match = re.compile('name="(.+?)"').findall(link)

        if len(match) == 0:
            return False

        themes = []
        for item in match:
            themes.append(item)

        if len(themes) > 0:
            if count:
                return len(themes)
            else:
                return themes
        else:
            return False
def create_code():
    from resources.libs.common import tools

    dialog = xbmcgui.Dialog()

    url = tools.get_keyboard(
        '', "{0}: Insert the URL for the QR Code.".format(CONFIG.ADDONTITLE))
    response = tools.open_url(url, check=True)

    if not response:
        if not dialog.yesno(
                CONFIG.ADDONTITLE,
                "[COLOR {0}]It seems the URL you entered either isn't valid or isn\'t working, Would you like to create it anyways?[/COLOR]"
                .format(CONFIG.COLOR2),
                "[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, url),
                yeslabel="[B][COLOR red]Yes Create[/COLOR][/B]",
                nolabel="[B][COLOR springgreen]No Cancel[/COLOR][/B]"):
            return
    name = tools.get_keyboard(
        '', "{0}: Insert the name for the QR Code.".format(CONFIG.ADDONTITLE))
    name = "QR_Code_{0}".format(tools.id_generator(6)) if name == "" else name
    image = generate_code(url, name)
    dialog.ok(
        CONFIG.ADDONTITLE,
        "[COLOR {0}]The QR Code image has been created and is located in the addon_data directory:[/COLOR]"
        .format(CONFIG.COLOR2),
        "[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1,
                                        image.replace(CONFIG.HOME, '')))
Ejemplo n.º 13
0
    def choose(self, location):
        from resources.libs import skin

        skin.look_and_feel_data('restore')
        external = 'External' if self.external else 'Local'

        file = self.dialog.browseSingle(1, '[COLOR {0}]Selecione o arquivo de backup que deseja restaurar[/COLOR]'.format(
            CONFIG.COLOR2), '' if self.external else 'files', mask='.zip', useThumbs=True,
                                        defaultt=None if self.external else CONFIG.MYBUILDS)

        if not file.endswith('.zip'):
            logging.log_notify(CONFIG.ADDONTITLE,
                               "[COLOR {0}]{1} Restaurar: Cancelado[/COLOR]".format(
                                   CONFIG.COLOR2, external))
            return

        if self.external:
            from resources.libs.common import tools
            response = tools.open_url(file, check=True)

            if not response:
                logging.log_notify(CONFIG.ADDONTITLE,
                                   "[COLOR {0}]Restauração externa: URL inválido[/COLOR]".format(CONFIG.COLOR2))
                return

        skin.skin_to_default("Restore")
        self.progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Installing {1} Backup'.format(CONFIG.COLOR2, external) + '\n' + 'Por favor, aguarde...[/COLOR]')

        self._from_file(file, location)
Ejemplo n.º 14
0
    def write_advanced(self, name, url):
        response = tools.open_url(url)

        if response:
            if os.path.exists(CONFIG.ADVANCED):
                choice = self.dialog.yesno(CONFIG.ADDONTITLE,
                                           "[COLOR {0}]Você gostaria de substituir suas configurações avançadas atuais com [COLOR {1}]{2}[/COLOR]?[/COLOR]".format(
                                               CONFIG.COLOR2, CONFIG.COLOR1, name),
                                           yeslabel="[B][COLOR springgreen]Sobrescrever[/COLOR][/B]",
                                           nolabel="[B][COLOR red]Cancelar[/COLOR][/B]")
            else:
                choice = self.dialog.yesno(CONFIG.ADDONTITLE,
                                           "[COLOR {0}]Você gostaria de baixar e instalar[COLOR {1}]{2}[/COLOR]?[/COLOR]".format(
                                               CONFIG.COLOR2, CONFIG.COLOR1, name),
                                           yeslabel="[B][COLOR springgreen]Instalar[/COLOR][/B]",
                                           nolabel="[B][COLOR red]Cancelar[/COLOR][/B]")

            if choice == 1:
                tools.write_to_file(CONFIG.ADVANCED, response.text)
                tools.kill_kodi(msg='[COLOR {0}]Instalar A nova predefinição advancedsettings.xml foi escrita com sucesso, mas as alterações não terão efeito até que você feche o Kodi.[/COLOR]'.format(
                                   CONFIG.COLOR2))
            else:
                logging.log("[Configurações avançadas] instalação cancelada")
                logging.log_notify('[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE),
                                   "[COLOR {0}]Escrita cancelada![/COLOR]".format(CONFIG.COLOR2))
                return
        else:
            logging.log("[Configurações avançadas] URL não funciona: {0}".format(url))
            logging.log_notify('[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, CONFIG.ADDONTITLE),
                               "[COLOR {0}]URL não funcionaF[/COLOR]".format(CONFIG.COLOR2))
def test_notify():
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    response = tools.open_url(CONFIG.NOTIFICATION, check=True)

    if response:
        try:
            id, msg = window.split_notify(CONFIG.NOTIFICATION)
            if not id:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    "[COLOR {0}]Notificação: não formatado corretamente[/COLOR]"
                    .format(CONFIG.COLOR2))
                return
            window.show_notification(msg, test=True)
        except Exception as e:
            logging.log("Error on Notifications Window: {0}".format(str(e)),
                        level=xbmc.LOGERROR)
    else:
        logging.log_notify(
            CONFIG.ADDONTITLE,
            "[COLOR {0}]URL inválido para notificação[/COLOR]".format(
                CONFIG.COLOR2))
Ejemplo n.º 16
0
    def choose(self, location):
        from resources.libs import skin

        skin.look_and_feel_data()
        external = 'External' if self.external else 'Local'

        file = self.dialog.browseSingle(1, '[COLOR {0}]Select the backup file you want to restore[/COLOR]'.format(
            CONFIG.COLOR2), '' if self.external else 'files', mask='.zip', useThumbs=True,
                                        defaultt=None if self.external else CONFIG.MYBUILDS)

        if not file.endswith('.zip'):
            logging.log_notify(CONFIG.ADDONTITLE,
                               "[COLOR {0}]{1} Restore: Cancelled[/COLOR]".format(
                                   CONFIG.COLOR2, external))
            return

        if self.external:
            from resources.libs.common import tools
            response = tools.open_url(file, check=True)

            if not response:
                logging.log_notify(CONFIG.ADDONTITLE,
                                   "[COLOR {0}]External Restore: Invalid URL[/COLOR]".format(CONFIG.COLOR2))
                return

        skin.skin_to_default("Restore")
        self.progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Installing {1} Backup'.format(
            CONFIG.COLOR2, external), '', 'Please Wait[/COLOR]')

        self._from_file(file, location)
Ejemplo n.º 17
0
def test_notify():
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    response = tools.open_url(CONFIG.NOTIFICATION, check=True)

    if response:
        try:
            id, msg = window.split_notify(CONFIG.NOTIFICATION)
            if not id:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    "[COLOR {0}]Notification: Not Formatted Correctly[/COLOR]".
                    format(CONFIG.COLOR2))
                return
            window.show_notification(msg, True)
        except Exception as e:
            logging.log("Error on Notifications Window: {0}".format(str(e)),
                        level=xbmc.LOGERROR)
    else:
        logging.log_notify(
            CONFIG.ADDONTITLE,
            "[COLOR {0}]Invalid URL for Notification[/COLOR]".format(
                CONFIG.COLOR2))
Ejemplo n.º 18
0
def check_build_update():
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    response = tools.open_url(CONFIG.BUILDFILE)

    if not response:
        return

    link = response.text.replace('\n', '').replace('\r', '').replace('\t', '')
    match = re.compile('name="%s".+?ersion="(.+?)".+?con="(.+?)".+?anart="(.+?)"' % CONFIG.BUILDNAME).findall(link)
    if len(match) > 0:
        version = match[0][0]
        icon = match[0][1]
        fanart = match[0][2]
        CONFIG.set_setting('latestversion', version)
        if version > CONFIG.BUILDVERSION:
            if CONFIG.DISABLEUPDATE == 'false':
                logging.log("[Check Updates] [Installed Version: {0}] [Current Version: {1}] Opening Update Window".format(CONFIG.BUILDVERSION, version))
                window.show_update_window(CONFIG.BUILDNAME, CONFIG.BUILDVERSION, version, icon, fanart)
            else:
                logging.log("[Check Updates] [Installed Version: {0}] [Current Version: {1}] Update Window Disabled".format(CONFIG.BUILDVERSION, version))
        else:
            logging.log("[Check Updates] [Installed Version: {0}] [Current Version: {1}]".format(CONFIG.BUILDVERSION, version))
    else:
        logging.log("[Check Updates] ERROR: Unable to find build version in build text file", level=xbmc.LOGERROR)
Ejemplo n.º 19
0
def check_theme(name, theme, ret):
    from resources.libs.common import tools

    themeurl = check_build(name, 'theme')
    response = tools.open_url(themeurl)

    if not response:
        return False

    link = response.text.replace('\n', '').replace('\r', '').replace('\t', '')
    match = re.compile(
        'name="{0}".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult=(.+?).+?escription="(.+?)"'
        .format(theme)).findall(link)
    if len(match) > 0:
        for url, icon, fanart, adult, description in match:
            if ret == 'url':
                return url
            elif ret == 'icon':
                return icon
            elif ret == 'fanart':
                return fanart
            elif ret == 'adult':
                return adult
            elif ret == 'description':
                return description
            elif ret == 'all':
                return name, theme, url, icon, fanart, adult, description
Ejemplo n.º 20
0
    def download(self, url, dest):
        self.progress_dialog.create(CONFIG.ADDONTITLE, "Downloading Content",
                                    ' ', ' ')
        self.progress_dialog.update(0)

        path = os.path.split(dest)[0]
        if not os.path.exists(path):
            os.makedirs(path)
        with open(dest, 'wb') as f:
            response = tools.open_url(url, stream=True)

            if not response:
                logging.log_notify(
                    CONFIG.ADDONTITLE,
                    '[COLOR {0}]Build Install: Invalid Zip Url![/COLOR]'.
                    format(CONFIG.COLOR2))
                return
            else:
                total = response.headers.get('content-length')

            if total is None:
                f.write(response.content)
            else:
                downloaded = 0
                total = int(total)
                start_time = time.time()
                mb = 1024 * 1024

                for chunk in response.iter_content(
                        chunk_size=max(int(total / 512), mb)):
                    downloaded += len(chunk)
                    f.write(chunk)

                    done = int(100 * downloaded / total)
                    kbps_speed = downloaded / (time.time() - start_time)

                    if kbps_speed > 0 and not done >= 100:
                        eta = (total - downloaded) / kbps_speed
                    else:
                        eta = 0

                    kbps_speed = kbps_speed / 1024
                    type_speed = 'KB'

                    if kbps_speed >= 1024:
                        kbps_speed = kbps_speed / 1024
                        type_speed = 'MB'

                    currently_downloaded = '[COLOR %s][B]Size:[/B] [COLOR %s]%.02f[/COLOR] MB of [COLOR %s]%.02f[/COLOR] MB[/COLOR]' % (
                        CONFIG.COLOR2, CONFIG.COLOR1, downloaded / mb,
                        CONFIG.COLOR1, total / mb)
                    speed = '[COLOR %s][B]Speed:[/B] [COLOR %s]%.02f [/COLOR]%s/s ' % (
                        CONFIG.COLOR2, CONFIG.COLOR1, kbps_speed, type_speed)
                    div = divmod(eta, 60)
                    speed += '[B]ETA:[/B] [COLOR %s]%02d:%02d[/COLOR][/COLOR]' % (
                        CONFIG.COLOR1, div[0], div[1])

                    self.progress_dialog.update(done, '', currently_downloaded,
                                                speed)
Ejemplo n.º 21
0
    def gui(self, name, over=False):
        if name == CONFIG.get_setting('buildname'):
            if over:
                yes_pressed = 1
            else:
                yes_pressed = self.dialog.yesno(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]Would you like to apply the guifix for:'.format(CONFIG.COLOR2) + '\n' + '[COLOR {0}]{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, name),
                                   nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                                   yeslabel='[B][COLOR springgreen]Apply Fix[/COLOR][/B]')
        else:
            yes_pressed = self.dialog.yesno("{0} - [COLOR red]WARNING!![/COLOR]".format(CONFIG.ADDONTITLE),
                               "[COLOR {0}][COLOR {1}]{2}[/COLOR] community build is not currently installed.".format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + "Would you like to apply the guiFix anyways?.[/COLOR]",
                               nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
                               yeslabel='[B][COLOR springgreen]Apply Fix[/COLOR][/B]')
        if yes_pressed:
            guizip = check.check_build(name, 'gui')
            zipname = name.replace('\\', '').replace('/', '').replace(':', '').replace('*', '').replace('?', '').replace('"', '').replace('<', '').replace('>', '').replace('|', '')

            response = tools.open_url(guizip, check=True)
            if not response:
                logging.log_notify(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]GuiFix: Invalid Zip Url![/COLOR]'.format(CONFIG.COLOR2))
                return

            self.dialogProgress.create(CONFIG.ADDONTITLE, '[COLOR {0}][B]Downloading GuiFix:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name), '', 'Please Wait')

            lib = os.path.join(CONFIG.PACKAGES, '{0}_guisettings.zip'.format(zipname))
            
            try:
                os.remove(lib)
            except:
                pass

            Downloader().download(guizip, lib)
            xbmc.sleep(500)
            
            if os.path.getsize(lib) == 0:
                try:
                    os.remove(lib)
                except:
                    pass
                    
                return
            
            title = '[COLOR {0}][B]Installing:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name)
            self.dialogProgress.update(0, title + '\n' + 'Please Wait')
            extract.all(lib, CONFIG.USERDATA, title=title)
            self.dialogProgress.close()
            skin.skin_to_default('Build Install')
            skin.look_and_feel_data('save')
            installed = db.grab_addons(lib)
            db.addon_database(installed, 1, True)

            self.dialog.ok(CONFIG.ADDONTITLE, "[COLOR {0}]To save changes you now need to force close Kodi, Press OK to force close Kodi[/COLOR]".format(CONFIG.COLOR2))
            tools.kill_kodi(over=True)
        else:
            logging.log_notify(CONFIG.ADDONTITLE,
                               '[COLOR {0}]GuiFix: Cancelled![/COLOR]'.format(CONFIG.COLOR2))
Ejemplo n.º 22
0
    def __init__(self):
        self.bf = None
        self.link = None

        response = tools.open_url(CONFIG.BUILDFILE)

        if response:
            self.bf = response.text
            self.link = tools.clean_text(self.bf)
Ejemplo n.º 23
0
def install_addon_from_url(name, url):
    from resources.libs.downloader import Downloader
    from resources.libs import db
    from resources.libs import extract
    from resources.libs.common import logging
    from resources.libs import skin
    from resources.libs.common import tools

    progress_dialog = xbmcgui.DialogProgress()

    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, name, CONFIG.COLOR2))
        return
    if not os.path.exists(CONFIG.PACKAGES):
        os.makedirs(CONFIG.PACKAGES)

    progress_dialog.create(
        CONFIG.ADDONTITLE,
        '[COLOR {0}][B]Downloading:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1,
            name), '', '[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, name)
    progress_dialog.update(
        0, title, '', '[COLOR {0}]Please Wait[/COLOR]'.format(CONFIG.COLOR2))
    percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
    progress_dialog.update(
        0, title, '',
        '[COLOR {0}]Installing Dependencies[/COLOR]'.format(CONFIG.COLOR2))
    installed(name)
    installlist = db.grab_addons(lib)
    logging.log(str(installlist))
    db.addon_database(installlist, 1, True)
    install_dependency(name, progress_dialog)
    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')
Ejemplo n.º 24
0
    def get_listing(self):
        from resources.libs import test
        
        response = tools.open_url(CONFIG.BUILDFILE)
        
        if response:
            link = tools.clean_text(response.text)
        else:
            directory.add_file('Kodi Version: {0}'.format(CONFIG.KODIV), icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
            directory.add_dir('Save Data Menu', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME3)
            directory.add_separator()
            directory.add_file('URL for txt file not valid', icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3)
            directory.add_file('{0}'.format(CONFIG.BUILDFILE), icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3)
            return

        total, count19, adultcount, hidden = check.build_count()

        match = re.compile('name="(.+?)".+?ersion="(.+?)".+?rl="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?dult="(.+?)".+?escription="(.+?)"').findall(link)
        
        if total == 1:
            for name, version, url, gui, kodi, theme, icon, fanart, adult, description in match:
                if not CONFIG.SHOWADULT == 'true' and adult.lower() == 'yes':
                    continue
                if not CONFIG.DEVELOPER == 'true' and test.str_test(name):
                    continue

                self.view_build(match[0][0])
                return

        directory.add_file('Kodi Version: {0}'.format(CONFIG.KODIV), icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3)
        directory.add_dir('Save Data Menu', {'mode': 'savedata'}, icon=CONFIG.ICONSAVE, themeit=CONFIG.THEME3)
        directory.add_separator()

        if len(match) >= 1:
            if CONFIG.SEPARATE == 'true':
                self._list_all(match)
            else:
                if count19 > 0:
                    state = '+' if CONFIG.SHOW19 == 'false' else '-'
                    directory.add_file('[B]{0} Matrix Builds ({1})[/B]'.format(state, count19), {'mode': 'togglesetting',
                                       'name': 'show19'}, themeit=CONFIG.THEME3)
                    if CONFIG.SHOW19 == 'true':
                        self._list_all(match, kodiv=19)

        elif hidden > 0:
            if adultcount > 0:
                directory.add_file('There is currently only Adult builds', icon=CONFIG.ICONBUILDS,
                                   themeit=CONFIG.THEME3)
                directory.add_file('Enable Show Adults in Addon Settings > Misc', icon=CONFIG.ICONBUILDS,
                                   themeit=CONFIG.THEME3)
            else:
                directory.add_file('Currently No Builds Offered from {0}'.format(CONFIG.ADDONTITLE),
                                   icon=CONFIG.ICONBUILDS, themeit=CONFIG.THEME3)
        else:
            directory.add_file('Text file for builds not formatted correctly.', icon=CONFIG.ICONBUILDS,
                               themeit=CONFIG.THEME3)
Ejemplo n.º 25
0
    def install_skin(self, name, url):
        from resources.libs.downloader import Downloader
        from resources.libs import db
        from resources.libs import extract
        from resources.libs.common import logging
        from resources.libs import skin
        from resources.libs.common import tools

        progress_dialog = xbmcgui.DialogProgress()

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

        if not response:
            logging.log_notify(
                "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(
                    CONFIG.COLOR1),
                '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]Url del Zip Inválida![/COLOR]'
                .format(CONFIG.COLOR1, name, CONFIG.COLOR2))
            return

        if not os.path.exists(CONFIG.PACKAGES):
            os.makedirs(CONFIG.PACKAGES)

        progress_dialog.create(
            CONFIG.ADDONTITLE,
            '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
            format(CONFIG.COLOR2, CONFIG.COLOR1, name) + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))

        urlsplits = url.split('/')
        lib = xbmc.makeLegalFilename(
            os.path.join(CONFIG.PACKAGES, urlsplits[-1]))
        try:
            os.remove(lib)
        except:
            pass
        Downloader().download(url, lib)
        title = '[COLOR {0}][B]Instalando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1, name)
        progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.HOME, title=title)
        installed = db.grab_addons(lib)
        db.addon_database(installed, 1, True)
        progress_dialog.close()
        logging.log_notify(
            "[COLOR {0}]Instalador de Add-ons[/COLOR]".format(CONFIG.COLOR1),
            '[COLOR {0}]{1}: Instalado![/COLOR]'.format(CONFIG.COLOR2, name))
        xbmc.executebuiltin('UpdateAddonRepos()')
        xbmc.executebuiltin('UpdateLocalAddons()')
        for item in installed:
            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')
        xbmc.executebuiltin('Container.Refresh()')
Ejemplo n.º 26
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}]Instalador de Add-ons[/COLOR]".format(
                    CONFIG.COLOR1),
                '[COLOR {0}]{1}:[/COLOR] [COLOR {2}]URL inválido zip![/COLOR]'.
                format(CONFIG.COLOR1, plugin, CONFIG.COLOR2))
            return

        tools.ensure_folders(CONFIG.PACKAGES)

        self.progress_dialog.create(
            CONFIG.ADDONTITLE,
            '[COLOR {0}][B]Descargando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.
            format(CONFIG.COLOR2, CONFIG.COLOR1, plugin) + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/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]Instalando:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(
            CONFIG.COLOR2, CONFIG.COLOR1, plugin)
        self.progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Espere por Favor[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
        self.progress_dialog.update(
            0, title + '\n' + '' + '\n' +
            '[COLOR {0}]Instalando Dependencias[/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')
Ejemplo n.º 27
0
def check_data(name, ret):
    from resources.libs.common import tools
    if CONFIG.get_setting('choicelink') == 'true':
        response = tools.open_url(CONFIG.DATAFILE)
    elif CONFIG.get_setting('choicelink') == 'false':
        response = tools.open_url(CONFIG.CUSTOMLINK)
    if not response:
        return False

    link = response.text.replace('\n', '').replace('\r', '').replace('\t', '')\
        .replace('gui=""', 'gui="http://"').replace('theme=""', 'theme="http://"')
    match = re.compile(
        'name="%s".+?ersion="(.+?)".+?rl="(.+?)".+?inor="(.+?)".+?ui="(.+?)".+?odi="(.+?)".+?heme="(.+?)".+?con="(.+?)".+?anart="(.+?)".+?review="(.+?)".+?dult="(.+?)".+?nfo="(.+?)".+?escription="(.+?)"'
        % name).findall(link)
    if len(match) > 0:
        for version, url, minor, gui, kodi, theme, icon, fanart, preview, adult, info, description in match:
            if ret == 'version':
                return version
            elif ret == 'url':
                return url
            elif ret == 'minor':
                return minor
            elif ret == 'gui':
                return gui
            if ret == 'kodi':
                return kodi
            elif ret == 'theme':
                return theme
            elif ret == 'icon':
                return icon
            elif ret == 'fanart':
                return fanart
            elif ret == 'preview':
                return preview
            elif ret == 'adult':
                return adult
            elif ret == 'description':
                return description
            elif ret == 'info':
                return info
            elif ret == 'all':
                return name, version, url, minor, gui, kodi, theme, icon, fanart, preview, adult, info, description
    else:
        return False
Ejemplo n.º 28
0
def wizard_update():
    from resources.libs import check
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    dialog = xbmcgui.Dialog()
    progress_dialog = xbmcgui.DialogProgress()

    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if response:
        try:
            wid, ver, zip = check.check_wizard('all')
        except:
            return
        if ver > CONFIG.ADDON_VERSION:
            yes = dialog.yesno(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]Existe uma nova versão do {1}!'.format(CONFIG.COLOR2, CONFIG.ADDONTITLE)
                                   +'\n'+'Você gostaria de baixar [COLOR {0}]v{1}[/COLOR]?[/COLOR]'.format(CONFIG.COLOR1, ver),
                                   nolabel='[B][COLOR red]Você gostaria de baixar[/COLOR][/B]',
                                   yeslabel="[B][COLOR springgreen]Assistente de atualização[/COLOR][/B]")
            if yes:
                from resources.libs import db
                from resources.libs.common import tools

                logging.log("[Assistente de atualização automática] Assistente de instalação v{0}".format(ver))
                progress_dialog.create(CONFIG.ADDONTITLE, '[COLOR {0}]Download da atualização...'.format(CONFIG.COLOR2)
                                        +'\n'+''
                                        +'\n'+'Por favor, aguarde...[/COLOR]')
                lib = os.path.join(CONFIG.PACKAGES, '{0}-{1}.zip'.format(CONFIG.ADDON_ID, ver))
                try:
                    os.remove(lib)
                except:
                    pass
                from resources.libs.downloader import Downloader
                from resources.libs import extract
                Downloader().download(zip, lib)
                xbmc.sleep(2000)
                progress_dialog.update(0, '\n'+"Instalando{0} atualizar".format(CONFIG.ADDONTITLE))
                percent, errors, error = extract.all(lib, CONFIG.ADDONS, True)
                progress_dialog.close()
                xbmc.sleep(1000)
                db.force_check_updates(auto=True, over=True)
                xbmc.sleep(1000)
                logging.log_notify(CONFIG.ADDONTITLE,
                                   '[COLOR {0}]Add-on atualizado[/COLOR]'.format(CONFIG.COLOR2))
                logging.log("[Assistente de atualização automática] Assistente atualizado para v{0}".format(ver))
                tools.remove_file(os.path.join(CONFIG.ADDON_DATA, 'settings.xml'))
                window.show_save_data_settings()
            else:
                logging.log("[Assistente de atualização automática] Instalar novo assistente ignorado: {0}".format(ver))
        else:
            logging.log("[Assistente de atualização automática] Sem nova versão v{0}".format(ver))
    else:
        logging.log("[Assistente de atualização automática] Url para o arquivo do assistente não é válido: {0}".format(CONFIG.BUILDFILE))
Ejemplo n.º 29
0
    def build_video(self, name):
        from resources.libs import check
        from resources.libs import yt
        from resources.libs.common import logging
        from resources.libs.common import tools

        response = tools.open_url(CONFIG.BUILDFILE, check=True)

        if response:
            videofile = check.check_build(name, 'preview')
            if tools.open_url(videofile, check=True):
                yt.play_video(videofile)
            else:
                logging.log(
                    "[{0}]No se puede encontrar la URL para la vista previa del vídeo"
                    .format(name))
        else:
            logging.log(
                "[B][COLOR azure]La Build del archivo de texto no funciona:[/COLOR][/B] [COLOR blue]{0}[/COLOR]"
                .format(CONFIG.BUILDFILE))
Ejemplo n.º 30
0
 def build_video(self, name):
     from resources.libs import check
     from resources.libs import yt
     from resources.libs.common import logging
     from resources.libs.common import tools
     if 1 - 1: Oo0Ooo / o0oOOo0O0Ooo % iii1I1I * O00oOoOoO0o0O.i11iIiiIii
     iiiI11 = tools.open_url(CONFIG.BUILDFILE, check=True)
     if 2 - 2: I1ii11iIi11i * I11i - iIii1I11I1II1 + I1IiiI.oO0o % iii1I1I
     if iiiI11:
         ooOOOoOooOoO = check.check_build(name, 'preview')
         if tools.open_url(ooOOOoOooOoO, check=True):
             yt.play_video(ooOOOoOooOoO)
         else:
             logging.log(
                 "[{0}]Não foi possível encontrar url para a visualização do vídeo"
                 .format(name))
     else:
         logging.log(
             "O arquivo de texto de compilação não está funcionando: {0}".
             format(CONFIG.BUILDFILE))
         if 91 - 91: iii1I1I % i1IIi % iIii1I11I1II1