Esempio n. 1
0
 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()['.'], '.')
Esempio n. 2
0
 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)
Esempio n. 3
0
 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())
Esempio n. 4
0
 def test_get_gdrive_credentials_file_without_files(self):
     self.assertIsNone(Config.getGdriveCredentialsFile())
Esempio n. 5
0
 def test_get_gdrive_credentials_file_with_conf_credentials_file(self):
     self.fs.create_file('conf/credentials.json')
     self.assertIsNotNone(Config.getGdriveCredentialsFile())
Esempio n. 6
0
def getRegions(request, response):
    response.headers['Content-Type'] = 'application/json'
    response.write(json.dumps(Config.regionLanguages()))
Esempio n. 7
0
 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()
Esempio n. 8
0
 def onStateChanged(self, state):
     if self.check.isChecked():
         Config.download.addRegion(self.region)
     else:
         Config.download.removeRegion(self.region)
     Config.save()
Esempio n. 9
0
 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])
Esempio n. 10
0
	def onStateChanged(self, state):
		print(f"ConfCheckbox state changed: {state}")
		self.set(self.isChecked())
		Config.save()
Esempio n. 11
0
 def onStateChanged(self, state):
     self.set(self.isChecked())
     Config.save()
Esempio n. 12
0
    def save(self):
        Config.compression.level = self.value()
        Config.save()

        if self.parent:
            self.parent.save()
Esempio n. 13
0
    def save(self):
        Config.threads = self.value()
        Config.save()

        if self.parent:
            self.parent.save()
Esempio n. 14
0
                    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))
Esempio n. 15
0
 def onCheck(self, state):
     if state == Qt.Checked:
         Config.autolaunchBrowser = True
     else:
         Config.autolaunchBrowser = False
     Config.save()
Esempio n. 16
0
 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())
Esempio n. 17
0
File: Api.py Progetto: zhentan/nut
def getRegions(request, response):
    response.write(json.dumps(Config.regionLanguages()))
Esempio n. 18
0
 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))
Esempio n. 19
0
	def updatePath(self):
		Config.paths.scan[0] = self.textbox.text()
		Config.save()
Esempio n. 20
0
 def _on_right_thumb_value_changed(label, value):
     label.setText(_format_size(value))
     Config.download.fileSizeMax = value
     Config.save()