Esempio n. 1
0
 def c_wago_update(self, _, verbose=True):
     if os.path.isdir(Path('Interface/AddOns/WeakAuras')) or os.path.isdir(Path('Interface/AddOns/Plater')):
         accounts = self.core.detect_accounts()
         if self.core.config['WAAccountName'] != '' and self.core.config['WAAccountName'] not in accounts:
             self.core.config['WAAccountName'] = ''
         if len(accounts) == 0:
             return
         elif len(accounts) > 1 and self.core.config['WAAccountName'] == '':
             if verbose:
                 self.console.print('More than one WoW account detected.\nPlease use [bold white]set wago_wow_accoun'
                                    't[''/bold white] command to set the correct account name.')
             else:
                 self.console.print('\n[green]More than one WoW account detected.[/green]\nPlease use [bold white]se'
                                    't wago_wow_account[/bold white] command to set the correct account name.')
             return
         elif len(accounts) == 1 and self.core.config['WAAccountName'] == '':
             self.core.config['WAAccountName'] = accounts[0]
             self.core.save_config()
         wago = WagoUpdater(self.core.config, self.core.masterConfig)
         if self.core.masterConfig['WagoVersion'] != self.core.config['WACompanionVersion']:
             self.core.config['WACompanionVersion'] = self.core.masterConfig['WagoVersion']
             self.core.save_config()
             force = True
         else:
             force = False
         wago.install_companion(self.core.clientType, force)
         statuswa, statusplater = wago.update()
         if verbose:
             if len(statuswa[0]) > 0 or len(statuswa[1]) > 0:
                 self.console.print('[green]Outdated WeakAuras:[/green]')
                 for aura in statuswa[0]:
                     self.console.print(f'[link={aura[1]}]{aura[0]}[/link]', highlight=False)
                 self.console.print('\n[green]Detected WeakAuras:[/green]')
                 for aura in statuswa[1]:
                     self.console.print(f'[link={aura[1]}]{aura[0]}[/link]', highlight=False)
             if len(statusplater[0]) > 0 or len(statusplater[1]) > 0:
                 if len(statuswa[0]) != 0 or len(statuswa[1]) != 0:
                     self.console.print('')
                 self.console.print('[green]Outdated Plater profiles/scripts:[/green]')
                 for aura in statusplater[0]:
                     self.console.print(f'[link={aura[1]}]{aura[0]}[/link]', highlight=False)
                 self.console.print('\n[green]Detected Plater profiles/scripts:[/green]')
                 for aura in statusplater[1]:
                     self.console.print(f'[link={aura[1]}]{aura[0]}[/link]', highlight=False)
         else:
             self.console.control('\033[A')
             if len(statuswa[0]) > 0:
                 self.console.print(f'\n[green]The number of outdated WeakAuras:[/green] '
                                    f'{len(statuswa[0])}', highlight=False)
             if len(statusplater[0]) > 0:
                 self.console.print(f'\n[green]The number of outdated Plater profiles/scripts:[/green] '
                                    f'{len(statusplater[0])}', highlight=False)
     elif verbose:
         self.console.print('No compatible addon is installed.')
Esempio n. 2
0
 def c_wa_update(self, _, verbose=True):
     if os.path.isdir(Path('Interface/AddOns/WeakAuras')):
         accounts = self.core.detect_accounts()
         if len(accounts) == 0:
             return
         elif len(accounts) > 1 and self.core.config['WAAccountName'] == '':
             if verbose:
                 self.console.print(
                     'More than one WoW account detected.\nPlease use [bold white]set_wa_wow_account['
                     '/bold white] command to set the correct account name.'
                 )
             else:
                 self.console.print(
                     '\n[green]More than one WoW account detected.[/green]\nPlease use [bold white]se'
                     't_wa_wow_account[/bold white] command to set the correct account name.'
                 )
             return
         elif len(
                 accounts) == 1 and self.core.config['WAAccountName'] == '':
             self.core.config['WAAccountName'] = accounts[0]
             self.core.save_config()
         wa = WagoUpdater(self.core.config['WAUsername'],
                          self.core.config['WAAccountName'],
                          self.core.config['WAAPIKey'])
         if self.core.waCompanionVersion != self.core.config[
                 'WACompanionVersion']:
             self.core.config[
                 'WACompanionVersion'] = self.core.waCompanionVersion
             self.core.save_config()
             force = True
         else:
             force = False
         wa.parse_storage()
         status = wa.check_updates()
         wa.install_companion(self.core.clientType, force)
         wa.install_data()
         if verbose:
             self.console.print('[green]Outdated WeakAuras:[/green]')
             for aura in status[0]:
                 self.console.print(aura, highlight=False)
             self.console.print('\n[green]Detected WeakAuras:[/green]')
             for aura in status[1]:
                 self.console.print(aura, highlight=False)
         else:
             self.console.print(
                 f'\n[green]The number of outdated WeakAuras:[/green] {len(status[0])}',
                 highlight=False)
     elif verbose:
         self.console.print('WeakAuras addon is not installed.')