Save servers config before .env
This is just logical to save servers first because .env would point to
entry in servers.yml
MODIFY
plextraktsync/commands/plex_login.py
plextraktsync/commands/plex_login.py
@@ -210,12 +210,6 @@ def login(username: str, password: str):
else:
plex_account_token = account._token
- CONFIG["PLEX_OWNER_TOKEN"] = plex_owner_token
- CONFIG["PLEX_ACCOUNT_TOKEN"] = plex_account_token
- CONFIG["PLEX_USERNAME"] = user
- CONFIG["PLEX_SERVER"] = server.name
- CONFIG.save()
-
sc = ServerConfig()
sc.add_server(
name=server.name,
@@ -227,4 +221,10 @@ def login(username: str, password: str):
)
sc.save()
+ CONFIG["PLEX_OWNER_TOKEN"] = plex_owner_token
+ CONFIG["PLEX_ACCOUNT_TOKEN"] = plex_account_token
+ CONFIG["PLEX_USERNAME"] = user
+ CONFIG["PLEX_SERVER"] = server.name
+ CONFIG.save()
+
click.echo(SUCCESS_MESSAGE)

Save servers config before .env

This is just logical to save servers first because .env would point to
entry in servers.yml