Use login command to log in
Need to disable standalone_mode of the login command never returns
MODIFY
plex_trakt_sync/cli.py
plex_trakt_sync/cli.py
from plex_trakt_sync.commands.clear_collections import clear_collections
from plex_trakt_sync.commands.inspect import inspect
from plex_trakt_sync.commands.login import login
-from plex_trakt_sync.commands.plex_login import plex_login, has_plex_token
+from plex_trakt_sync.commands.plex_login import plex_login
from plex_trakt_sync.commands.sync import sync
-from plex_trakt_sync.commands.trakt_login import trakt_login, has_trakt_token
+from plex_trakt_sync.commands.trakt_login import trakt_login
from plex_trakt_sync.commands.watch import watch
from plex_trakt_sync.commands.webhook import webhook
@@ -18,10 +18,6 @@ def cli(ctx):
Plex-Trakt-Sync is a two-way-sync between trakt.tv and Plex Media Server
"""
if not ctx.invoked_subcommand:
- if not has_plex_token():
- plex_login()
- if not has_trakt_token():
- trakt_login()
sync()

MODIFY
plex_trakt_sync/commands/sync.py
plex_trakt_sync/commands/sync.py
import click
from plexapi.server import PlexServer
+from plex_trakt_sync.commands.login import login
from plex_trakt_sync.media import MediaFactory, Media
from plex_trakt_sync.requests_cache import requests_cache
from plex_trakt_sync.plex_server import get_plex_server
@@ -132,12 +133,7 @@ def sync(sync_option: str, library: str, show: str, movie: str, batch_size: int)
if git_version:
logger.info(f"PlexTraktSync [{git_version}]")
- if not CONFIG["PLEX_TOKEN"] or not CONFIG["TRAKT_USERNAME"]:
- click.echo("First run, please follow those configuration instructions.")
- from get_env_data import get_env_data
- get_env_data()
- CONFIG.initialize()
-
+ login.main(standalone_mode=False)
logger.info(f"Syncing with Plex {CONFIG['PLEX_USERNAME']} and Trakt {CONFIG['TRAKT_USERNAME']}")
movies = sync_option in ["all", "movies"]

Use login command to log in

Need to disable standalone_mode of the login command never returns