fix trakt not saving authorization

This commit is contained in:
meisnate12 2021-12-27 19:01:43 -05:00
parent aa5fbf7fd1
commit b09f0dc366
3 changed files with 3 additions and 3 deletions

View file

@ -124,7 +124,7 @@ class ConfigFile:
if "sonarr" in new_config: new_config["sonarr"] = new_config.pop("sonarr") if "sonarr" in new_config: new_config["sonarr"] = new_config.pop("sonarr")
if "trakt" in new_config: new_config["trakt"] = new_config.pop("trakt") if "trakt" in new_config: new_config["trakt"] = new_config.pop("trakt")
if "mal" in new_config: new_config["mal"] = new_config.pop("mal") if "mal" in new_config: new_config["mal"] = new_config.pop("mal")
if not read_only: if not self.read_only:
yaml.round_trip_dump(new_config, open(self.config_path, "w", encoding="utf-8"), indent=None, block_seq_indent=2) yaml.round_trip_dump(new_config, open(self.config_path, "w", encoding="utf-8"), indent=None, block_seq_indent=2)
self.data = new_config self.data = new_config
except yaml.scanner.ScannerError as e: except yaml.scanner.ScannerError as e:

View file

@ -108,7 +108,7 @@ class MyAnimeList:
def _save(self, authorization): def _save(self, authorization):
if authorization is not None and "access_token" in authorization and authorization["access_token"] and self._check(authorization): if authorization is not None and "access_token" in authorization and authorization["access_token"] and self._check(authorization):
if self.authorization != authorization and self.config.read_only: if self.authorization != authorization and not self.config.read_only:
yaml.YAML().allow_duplicate_keys = True yaml.YAML().allow_duplicate_keys = True
config, ind, bsi = yaml.util.load_yaml_guess_indent(open(self.config_path)) config, ind, bsi = yaml.util.load_yaml_guess_indent(open(self.config_path))
config["mal"]["authorization"] = { config["mal"]["authorization"] = {

View file

@ -80,7 +80,7 @@ class Trakt:
def _save(self, authorization): def _save(self, authorization):
if authorization and self._check(authorization): if authorization and self._check(authorization):
if self.authorization != authorization and self.config.read_only: if self.authorization != authorization and not self.config.read_only:
yaml.YAML().allow_duplicate_keys = True yaml.YAML().allow_duplicate_keys = True
config, ind, bsi = yaml.util.load_yaml_guess_indent(open(self.config_path)) config, ind, bsi = yaml.util.load_yaml_guess_indent(open(self.config_path))
config["trakt"]["authorization"] = { config["trakt"]["authorization"] = {