Example #1
0
        def do_ignore(self):
            logging.log(
                "[Current Build Check] [User Selected: Ignore Build Menu] [Next Check: {0}]"
                .format(CONFIG.BUILDCHECK),
                level=xbmc.LOGINFO)
            CONFIG.set_setting(
                'nextbuildcheck',
                tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
            CONFIG.set_setting('installed', 'ignored')

            self.close()
def save_debrid():
    if CONFIG.DEBRIDSAVE <= str(tools.get_date()):
        from resources.libs import debridit
        logging.log("[Debrid Data] Saving all Data", level=xbmc.LOGNOTICE)
        debridit.auto_update('all')
        CONFIG.set_setting('debridlastsave', str(tools.get_date(days=3)))
    else:
        logging.log(
            "[Debrid Data] Next Auto Save isn't until: {0} / TODAY is: {1}".
            format(CONFIG.DEBRIDSAVE, str(tools.get_date())),
            level=xbmc.LOGNOTICE)
def save_login():
    if CONFIG.LOGINSAVE <= str(tools.get_date()):
        from resources.libs import loginit
        logging.log("[Login Info] Saving all Data", level=xbmc.LOGNOTICE)
        loginit.auto_update('all')
        CONFIG.set_setting('loginlastsave', str(tools.get_date(days=3)))
    else:
        logging.log(
            "[Login Info] Next Auto Save isn't until: {0} / TODAY is: {1}".
            format(CONFIG.LOGINSAVE, str(tools.get_date())),
            level=xbmc.LOGNOTICE)
def save_trakt():
    if CONFIG.TRAKTSAVE <= str(tools.get_date()):
        from resources.libs import traktit
        logging.log("[Trakt Data] Saving all Data", level=xbmc.LOGNOTICE)
        traktit.auto_update('all')
        CONFIG.set_setting('traktlastsave', str(tools.get_date(days=3)))
    else:
        logging.log(
            "[Trakt Data] Next Auto Save isn't until: {0} / TODAY is: {1}".
            format(CONFIG.TRAKTSAVE, str(tools.get_date())),
            level=xbmc.LOGNOTICE)
Example #5
0
 def do_ignore(self):
     logging.log(
         "[Verificação da compilação atual] [Selecionado pelo usuário: Menu Ignorar compilação] [Verificação seguinte: {0}]"
         .format(CONFIG.BUILDCHECK),
         level=xbmc.LOGINFO)
     CONFIG.set_setting(
         'nextbuildcheck',
         tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
     CONFIG.set_setting('installed', 'ignored')
     if 29 - 29: OOooOOo + Oo0Ooo.i11iIiiIii - i1IIi / iIii1I11I1II1
     self.close()
     if 26 - 26: I11i.OoooooooOO
    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),
                               '', '[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, '', '[COLOR {0}]Please Wait[/COLOR]'.format(CONFIG.COLOR2))
        percent, errors, error = extract.all(lib, CONFIG.ADDONS, title=title)
        self.progress_dialog.update(0, title, '', '[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')
Example #7
0
def build_update_check():
    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if not response:
        logging.log("[Build Check] No es una URL válida para el Archivo de  la Build: {0}".format(CONFIG.BUILDFILE), level=xbmc.LOGINFO)
    elif not CONFIG.BUILDNAME == '':
        if CONFIG.SKIN in ['skin.confluence', 'skin.estuary', 'skin.estouchy'] and not CONFIG.DEFAULTIGNORE == 'true':
            check.check_skin()

        logging.log("[Build Check] Build Instalado: Comprobando Actualizaciones", level=xbmc.LOGINFO)
        check.check_build_update()

    CONFIG.set_setting('nextbuildcheck', tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
Example #8
0
def build_update_check():
    response = tools.open_url(CONFIG.BUILDFILE, check=True)

    if not response:
        logging.log("[Build Check] Not a valid URL for Build File: {0}".format(CONFIG.BUILDFILE), level=xbmc.LOGINFO)
    elif not CONFIG.BUILDNAME == '':
        if CONFIG.SKIN in ['skin.confluence', 'skin.estuary', 'skin.estouchy'] and not CONFIG.DEFAULTIGNORE == 'true':
            check.check_skin()

        logging.log("[Build Check] Build Installed: Checking Updates", level=xbmc.LOGINFO)
        check.check_build_update()

    CONFIG.set_setting('nextbuildcheck', tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
Example #9
0
        def do_build_menu(self):
            from resources.libs.common import logging

            logging.log("[Current Build Check] [User Selected: Open Build Menu] [Next Check: {0}]".format(str(CONFIG.BUILDCHECK)),
                        level=xbmc.LOGNOTICE)
            CONFIG.set_setting('lastbuildcheck', str(CONFIG.BUILDCHECK))
            CONFIG.set_setting('installed', 'ignored')
            
            url = 'plugin://{0}/?mode=builds'.format(CONFIG.ADDON_ID)
            
            self.close()
            
            xbmc.executebuiltin('ActivateWindow(Programs, {0}, return)'.format(url))
Example #10
0
def choose_file_manager():
    if not xbmc.getCondVisibility('System.HasAddon(script.kodi.android.update)'):
        from resources.libs.gui import addon_menu
        addon_menu.install_from_kodi('script.kodi.android.update')
    
    try:
        updater = xbmcaddon.Addon('script.kodi.android.update')
    except RuntimeError as e:
        return False
        
    updater.setSetting('File_Manager', '1')
    
    CONFIG.open_settings('script.kodi.android.update', 0, 4, True)
Example #11
0
def save_login():
    current_time = time.mktime(time.strptime(tools.get_date(formatted=True), "%Y-%m-%d %H:%M:%S"))
    next_save = time.mktime(time.strptime(CONFIG.get_setting('loginnextsave'), "%Y-%m-%d %H:%M:%S"))
    
    if next_save <= current_time:
        from resources.libs import loginit
        logging.log("[Login Info] Saving all Data", level=xbmc.LOGINFO)
        loginit.auto_update('all')
        CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True))
    else:
        logging.log("[Login Info] Next Auto Save isn't until: {0} / TODAY is: {1}".format(CONFIG.get_setting('loginnextsave'),
                                                                                          tools.get_date(formatted=True)),
                    level=xbmc.LOGINFO)
Example #12
0
        def do_ignore(self):
            from resources.libs.common import logging
            from resources.libs.common import tools

            logging.log(
                "[Current Build Check] [User Selected: Ignore Build Menu] [Next Check: {0}]"
                .format(CONFIG.BUILDCHECK),
                level=xbmc.LOGNOTICE)
            CONFIG.set_setting(
                'nextbuildcheck',
                tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
            CONFIG.set_setting('installed', 'ignored')

            self.close()
Example #13
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}]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)
                      +'\n'+''
                      +'\n'+'[COLOR {0}]Please Wait[/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]Installing:[/B][/COLOR] [COLOR {1}]{2}[/COLOR]'.format(CONFIG.COLOR2, CONFIG.COLOR1, name)
        progress_dialog.update(0, title
                                    +'\n'+''
                                    +'\n'+'[COLOR {0}]Please Wait[/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}]Addon Installer[/COLOR]".format(CONFIG.COLOR1),
                           '[COLOR {0}]{1}: Installed![/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()')
Example #14
0
def clear_saved(who, over=False):
    if who == 'all':
        for debrid in DEBRIDID:
            clear_saved(debrid,  True)
    elif DEBRIDID[who]:
        file = DEBRIDID[who]['file']
        if os.path.exists(file):
            os.remove(file)
            logging.log_notify('[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, DEBRIDID[who]['name']),
                               '[COLOR {0}]Debrid Info: Removed![/COLOR]'.format(CONFIG.COLOR2),
                               2000,
                               DEBRIDID[who]['icon'])
        CONFIG.set_setting(DEBRIDID[who]['saved'], '')
    if not over:
        xbmc.executebuiltin('Container.Refresh()')
Example #15
0
def clear_saved(who, over=False):
    if who == 'all':
        for login in LOGINID:
            clear_saved(login,  True)
    elif LOGINID[who]:
        file = LOGINID[who]['file']
        if os.path.exists(file):
            os.remove(file)
            logging.log_notify('[COLOR {0}]{1}[/COLOR]'.format(CONFIG.COLOR1, LOGINID[who]['name']),
                               '[COLOR {0}]Login Info: Removed![/COLOR]'.format(CONFIG.COLOR2),
                               2000,
                               LOGINID[who]['icon'])
        CONFIG.set_setting(LOGINID[who]['saved'], '')
    if not over:
        xbmc.executebuiltin('Container.Refresh()')
Example #16
0
def clear_saved(who, over=False):
    if who == 'all':
        for trakt in TRAKTID:
            clear_saved(trakt,  True)
    elif TRAKTID[who]:
        file = TRAKTID[who]['file']
        if os.path.exists(file):
            os.remove(file)
            logging.log_notify("[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, TRAKTID[who]['name']),
                               '[COLOR {0}]Trakt Data: Removed![/COLOR]'.format(CONFIG.COLOR2),
                               2000,
                               TRAKTID[who]['icon'])
        CONFIG.set_setting(TRAKTID[who]['saved'], '')
    if not over:
        xbmc.executebuiltin('Container.Refresh()')
def stop_if_duplicate():
    NOW = datetime.now()
    temp = CONFIG.get_setting('time_started')
    if not temp == '':
        if temp > str(NOW - timedelta(minutes=2)):
            logging.log("Killing Start Up Script")
            sys.exit()
    logging.log("{0}".format(NOW))
    CONFIG.set_setting('time_started', str(NOW))
    xbmc.sleep(1000)
    if not CONFIG.get_setting('time_started') == str(NOW):
        logging.log("Killing Start Up Script")
        sys.exit()
    else:
        logging.log("Continuing Start Up Script")
Example #18
0
        def onClick(self, controlid):
            if controlid == self.okbutton:

                for item in self.controllist:
                    at = self.controllist.index(item)
                    if self.getControl(item).isSelected():
                        CONFIG.set_setting(self.controlsettings[at], 'true')
                    else:
                        CONFIG.set_setting(self.controlsettings[at], 'false')

                if self.getControl(self.whitelist).isSelected() and not self.whitelistcurrent == 'true':
                    from resources.libs import whitelist
                    whitelist.whitelist('edit')
                
                self.close()
Example #19
0
def auto_update(who):
    if who == 'all':
        for log in TRAKTID:
            if os.path.exists(TRAKTID[log]['path']):
                auto_update(log)
    elif TRAKTID[who]:
        if os.path.exists(TRAKTID[who]['path']):
            u = trakt_user(who)
            su = CONFIG.get_setting(TRAKTID[who]['saved'])
            n = TRAKTID[who]['name']
            if not u or u == '':
                return
            elif su == '':
                trakt_it('update', who)
            elif not u == su:
                dialog = xbmcgui.Dialog()

                if dialog.yesno(CONFIG.ADDONTITLE,
                                    "[COLOR {0}]Would you like to save the [COLOR {1}]Trakt Data[/COLOR] for [COLOR {2}]{3}[/COLOR]?".format(CONFIG.COLOR2, CONFIG.COLOR1, CONFIG.COLOR1, n),
                                    "Addon: [COLOR springgreen][B]{0}[/B][/COLOR]".format(u),
                                    "Saved:[/COLOR] [COLOR red][B]{0}[/B][/COLOR]".format(su) if not su == '' else 'Saved:[/COLOR] [COLOR red][B]None[/B][/COLOR]',
                                    yeslabel="[B][COLOR springgreen]Save Data[/COLOR][/B]",
                                    nolabel="[B][COLOR red]No Cancel[/COLOR][/B]"):
                    trakt_it('update', who)
            else:
                trakt_it('update', who)
Example #20
0
        def do_build_menu(self):
            logging.log(
                "[Current Build Check] [User Selected: Open Build Menu] [Next Check: {0}]"
                .format(CONFIG.BUILDCHECK),
                level=xbmc.LOGNOTICE)
            CONFIG.set_setting(
                'nextbuildcheck',
                tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
            CONFIG.set_setting('installed', 'ignored')

            url = 'plugin://{0}/?mode=builds'.format(CONFIG.ADDON_ID)

            self.close()

            xbmc.executebuiltin(
                'ActivateWindow(Programs, {0}, return)'.format(url))
Example #21
0
 def onInit(self):
     self.title = 101
     self.okbutton = 201
     self.trakt = 301
     self.debrid = 302
     self.login = 303
     self.sources = 304
     self.profiles = 305
     self.playercore = 314
     self.advanced = 306
     self.favourites = 307
     self.superfav = 308
     self.repo = 309
     self.whitelist = 310
     self.cache = 311
     self.packages = 312
     self.thumbs = 313
     self.show_dialog()
     self.controllist = [self.trakt, self.debrid, self.login,
                             self.sources, self.profiles, self.playercore, self.advanced,
                             self.favourites, self.superfav, self.repo,
                             self.whitelist, self.cache, self.packages,
                             self.thumbs]
     self.controlsettings = ['keeptrakt', 'keepdebrid', 'keeplogin',
                             'keepsources', 'keepprofiles', 'keepplayercore', 'keepadvanced',
                             'keepfavourites', 'keeprepos', 'keepsuper',
                             'keepwhitelist', 'clearcache', 'clearpackages',
                             'clearthumbs']
     for item in self.controllist:
         if CONFIG.get_setting(self.controlsettings[self.controllist.index(item)]) == 'true':
             self.getControl(item).setSelected(True)
Example #22
0
def import_list(who):
    if who == 'all':
        for log in DEBRIDID:
            if os.path.exists(DEBRIDID[log]['file']):
                import_list(log)
    elif DEBRIDID[who]:
        if os.path.exists(DEBRIDID[who]['file']):
            file = DEBRIDID[who]['file']
            addonid = tools.get_addon_by_id(DEBRIDID[who]['plugin'])
            saved = DEBRIDID[who]['saved']
            default = DEBRIDID[who]['default']
            suser = CONFIG.get_setting(saved)
            name = DEBRIDID[who]['name']

            tree = ElementTree.parse(file)
            root = tree.getroot()

            for setting in root.findall('debrid'):
                id = setting.find('id').text
                value = setting.find('value').text

                addonid.setSetting(id, value)

            logging.log_notify(
                "[COLOR {0}]{1}[/COLOR]".format(CONFIG.COLOR1, name),
                '[COLOR {0}]Debrid Info: Imported![/COLOR]'.format(
                    CONFIG.COLOR2))
Example #23
0
def auto_update(who):
    if who == 'all':
        for log in DEBRIDID:
            if os.path.exists(DEBRIDID[log]['path']):
                auto_update(log)
    elif DEBRIDID[who]:
        if os.path.exists(DEBRIDID[who]['path']):
            u = debrid_user(who)
            su = CONFIG.get_setting(DEBRIDID[who]['saved'])
            n = DEBRIDID[who]['name']
            if not u or u == '':
                return
            elif su == '':
                debrid_it('update', who)
            elif not u == su:
                dialog = xbmcgui.Dialog()

                if dialog.yesno(
                        CONFIG.ADDONTITLE,
                        "Le gustaría salvar la [COLOR {0}]Info Debrid[/COLOR] para [COLOR {1}]{2}[/COLOR]?"
                        .format(CONFIG.COLOR2, CONFIG.COLOR1, n) + '\n' +
                        "Addon: [COLOR springgreen][B]{0}[/B][/COLOR]".format(
                            u) + '\n' +
                        "Salvado:[/COLOR] [COLOR red][B]{0}[/B][/COLOR]".
                        format(su) if not su == '' else
                        'Salvado:[/COLOR] [COLOR red][B]Ninguno[/B][/COLOR]',
                        yeslabel=
                        "[B][COLOR springreen]Salvar Debrid[/COLOR][/B]",
                        nolabel="[B][COLOR red]No, Cancelar[/COLOR][/B]"):
                    debrid_it('update', who)
            else:
                debrid_it('update', who)
Example #24
0
def auto_update(who):
    if who == 'all':
        for log in DEBRIDID:
            if os.path.exists(DEBRIDID[log]['path']):
                auto_update(log)
    elif DEBRIDID[who]:
        if os.path.exists(DEBRIDID[who]['path']):
            u = debrid_user(who)
            su = CONFIG.get_setting(DEBRIDID[who]['saved'])
            n = DEBRIDID[who]['name']
            if not u or u == '':
                return
            elif su == '':
                debrid_it('update', who)
            elif not u == su:
                dialog = xbmcgui.Dialog()

                if dialog.yesno(
                        CONFIG.ADDONTITLE,
                        "Would you like to save the [COLOR {0}]Debrid Info[/COLOR] for [COLOR {1}]{2}[/COLOR]?"
                        .format(CONFIG.COLOR2, CONFIG.COLOR1, n),
                        "Addon: [COLOR springgreen][B]{0}[/B][/COLOR]".format(
                            u),
                        "Saved:[/COLOR] [COLOR red][B]{0}[/B][/COLOR]".format(
                            su) if not su == '' else
                        'Saved:[/COLOR] [COLOR red][B]None[/B][/COLOR]',
                        yeslabel="[B][COLOR springreen]Save Debrid[/COLOR][/B]",
                        nolabel="[B][COLOR red]No, Cancel[/COLOR][/B]"):
                    debrid_it('update', who)
            else:
                debrid_it('update', who)
Example #25
0
 def onClick(self, controlid):
     if controlid == self.okbutton:
         if 77 - 77: IiII / I1IiiI
         for iiI11 in self.controllist:
             I1 = self.controllist.index(iiI11)
             if self.getControl(iiI11).isSelected():
                 CONFIG.set_setting(self.controlsettings[I1], 'true')
             else:
                 CONFIG.set_setting(self.controlsettings[I1], 'false')
                 if 15 - 15: II111iiii
         if self.getControl(self.whitelist).isSelected(
         ) and not self.whitelistcurrent == 'true':
             from resources.libs import whitelist
             whitelist.whitelist('edit')
             if 18 - 18: i11iIiiIii.i1IIi % OoooooooOO / O0
         self.close()
         if 75 - 75: OoOoOO00 % o0oOOo0O0Ooo % o0oOOo0O0Ooo.I1Ii111
Example #26
0
 def do_build_menu(self):
     logging.log(
         "[Verificação de compilação atual] [Selecionado pelo usuário: Abrir menu de compilação] [Próxima verificação: {0}]"
         .format(CONFIG.BUILDCHECK),
         level=xbmc.LOGINFO)
     CONFIG.set_setting(
         'nextbuildcheck',
         tools.get_date(days=CONFIG.UPDATECHECK, formatted=True))
     CONFIG.set_setting('installed', 'ignored')
     if 34 - 34: IiII
     oOo = 'plugin://{0}/?mode=builds'.format(CONFIG.ADDON_ID)
     if 75 - 75: I1IiiI + Oo0Ooo
     self.close()
     if 73 - 73: O0 - OoooooooOO.OOooOOo - OOooOOo / OoOoOO00
     xbmc.executebuiltin(
         'ActivateWindow(Programs, {0}, return)'.format(oOo))
     if 45 - 45: iIii1I11I1II1 % OoO0O00
Example #27
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))
Example #28
0
 def backuprestore_menu(self):
     backuppath = CONFIG.get_setting('path')
     dialog = xbmcgui.Dialog()
     if backuppath=='':
         if dialog.ok(CONFIG.ADDONTITLE,'Bạn chưa thiết lập đường dẫn lưu file Backup cho Kodi \n Mở Addon Setting và Chọn tab [COLOR green][B]Zip Folder[/B][/COLOR].\n Nhấn [B]OK[/B] để bắt đầu thiết lập'):
             backupdir = dialog.browse(0, '[COLOR yellow]Chọn đường dẫn lưu file Backup[/COLOR]', '', '', False, False)
             CONFIG.set_setting('path', backupdir)
             xbmc.executebuiltin('Container.Refresh()')
             self.backuprestore_menu()
         else: MainMenu().get_listing()
         # xbmc.executebuiltin('Container.Refresh()')
     else:
        directory.add_file('[COLOR {0}][B]Backup Location:[/B][/COLOR] {1}'.format(CONFIG.COLOR1, backuppath), {'mode': 'settings', 'name': 'Maintenance'}, icon=CONFIG.ICONDIR, themeit=CONFIG.THEME3)
        directory.add_file('[COLOR {0}][B]Clean Backup:[/B][/COLOR] Dọn dẹp thư mục Backup'.format(CONFIG.COLOR1), {'mode': 'clearbackup'}, icon=CONFIG.ICONDELPACK, themeit=CONFIG.THEME3)
        directory.add_file('[COLOR red][B]Refresh KODI[/B][/COLOR] - Khôi phục Kodi về mặc định (giữ nguyên Repository)', {'mode': 'freshstart'}, icon=CONFIG.ICONMAINT, themeit=CONFIG.THEME3)
        directory.add_separator()
        directory.add_dir('[COLOR green][B]BACKUP:[/B][/COLOR] Sao lưu Kodi', {'mode': 'maint', 'name': 'backup'}, icon=CONFIG.ICONBACKUP, themeit=CONFIG.THEME1)
        directory.add_dir('[COLOR yellow][B]RESTORE:[/B][/COLOR] Khôi phục Kodi', {'mode': 'maint', 'name': 'restore'}, icon=CONFIG.ICONRESTORE, themeit=CONFIG.THEME1)
Example #29
0
def stop_if_duplicate():
    NOW = time.time()
    temp = CONFIG.get_setting('time_started')
    
    if temp:
        if temp > NOW - (60 * 2):
            logging.log('Killing Start Up Script')
            sys.exit()
            
    logging.log("{0}".format(NOW))
    CONFIG.set_setting('time_started', NOW)
    xbmc.sleep(1000)
    
    if not CONFIG.get_setting('time_started') == NOW:
        logging.log('Killing Start Up Script')
        sys.exit()
    else:
        logging.log('Continuing Start Up Script')
def save_debrid():
    if CONFIG.DEBRIDSAVE <= time.mktime(
            time.strptime(tools.get_date(formatted=True),
                          "%Y-%m-%d %H:%M:%S")):
        from resources.libs import debridit
        logging.log("[Debrid Data] Saving all Data", level=xbmc.LOGNOTICE)
        debridit.auto_update('all')
        CONFIG.set_setting('debridnextsave',
                           tools.get_date(days=3, formatted=True))
    else:
        local_time = time.localtime(
            time.mktime(
                time.strptime(CONFIG.get_setting('debridnextsave'),
                              "%Y-%m-%d %H:%M:%S")))
        logging.log(
            "[Debrid Data] Next Auto Save isn't until: {0} / TODAY is: {1}".
            format(local_time, tools.get_date(formatted=True)),
            level=xbmc.LOGNOTICE)