def test_mapping_with_gdrive_credentials_file(self): self.assertIsNone(Config.getGdriveCredentialsFile()) self.fs.create_file('credentials.json') self.assertEqual(Config.paths.mapping()['gdrive'], '') self.assertEqual(Config.paths.mapping()['.'], '.')
def test_load_non_existing_file(self): with self.assertRaises(OSError): Config.load(_get_default_config_path()) self.assertListEqual(Config.paths.scan, ['.']) self.assertEqual(Config.server.hostname, '0.0.0.0') self.assertEqual(Config.server.port, 9000)
def test_save_default_config_with_implicit_config_path(self): conf_file = _get_default_config_path() self.assertFalse(os.path.exists(conf_file)) Config.save() self.__compare_config_in_file_with_object(conf_file, _get_default_config_object())
def test_get_gdrive_credentials_file_without_files(self): self.assertIsNone(Config.getGdriveCredentialsFile())
def test_get_gdrive_credentials_file_with_conf_credentials_file(self): self.fs.create_file('conf/credentials.json') self.assertIsNotNone(Config.getGdriveCredentialsFile())
def getRegions(request, response): response.headers['Content-Type'] = 'application/json' response.write(json.dumps(Config.regionLanguages()))
def _on_thumb_value_changed(label, value, config_param, isSize=True): label.setText( humanize.naturalsize(value, True) if isSize else str(value)) setattr(Config.download, config_param, value) Config.save()
def onStateChanged(self, state): if self.check.isChecked(): Config.download.addRegion(self.region) else: Config.download.removeRegion(self.region) Config.save()
def test_update_scan_paths_with_single_path(self): initial_scan_paths = ['.'] Config.paths.scan = initial_scan_paths new_scan_path = "titles" Config.update_scan_paths(new_scan_path, Nsps.files) self.assertEqual(Config.paths.scan, [new_scan_path])
def onStateChanged(self, state): print(f"ConfCheckbox state changed: {state}") self.set(self.isChecked()) Config.save()
def onStateChanged(self, state): self.set(self.isChecked()) Config.save()
def save(self): Config.compression.level = self.value() Config.save() if self.parent: self.parent.save()
def save(self): Config.threads = self.value() Config.save() if self.parent: self.parent.save()
nut.initFiles() for d in args.download: download(d) if args.system_update: cdn.downloadSystemUpdate() if args.scrape_shogun is not None: if len(args.scrape_shogun) == 0: nut.scrapeShogunThreaded(True) else: nut.initTitles() nut.initFiles() for i in args.scrape_shogun: if len(i) == 16: for region in Config.regionLanguages(): if args.region and region != args.region: continue for language in Config.regionLanguages( )[region]: if args.language and args.language != language: continue l = cdn.Shogun.ids(i, region=region, language=language or 'en', force=True) print('searching %s %s' % (region, language))
def onCheck(self, state): if state == Qt.Checked: Config.autolaunchBrowser = True else: Config.autolaunchBrowser = False Config.save()
def test_region_languages_with_empty_file(self): self.assertEqual(Config.regionLanguages(), _get_default_languages()) # return same object self.assertEqual(Config.regionLanguages(), _get_default_languages())
def getRegions(request, response): response.write(json.dumps(Config.regionLanguages()))
def test_regional_languages_from_file(self): file_ = 'titledb/languages.json' languages = '{"CO":["en","es"],"AR":["en","es"],"CL":["en","es"]}' self.fs.create_file(file_, contents=languages) self.assertEqual(Config.regionLanguages(), json.loads(languages))
def updatePath(self): Config.paths.scan[0] = self.textbox.text() Config.save()
def _on_right_thumb_value_changed(label, value): label.setText(_format_size(value)) Config.download.fileSizeMax = value Config.save()