Use spinner from rich for trakt lists cache status
MODIFY
plex_trakt_sync/commands/sync.py
plex_trakt_sync/commands/sync.py
import click
from tqdm import tqdm
+from rich.console import Console
from plex_trakt_sync.commands.login import ensure_login
from plex_trakt_sync.decorators.measure_time import measure_time
def sync_all(walker: Walker, trakt: TraktApi, plex: PlexApi, runner: Sync, dry_run: bool):
+ console = Console()
listutil = TraktListUtil()
- with measure_time("Loaded Trakt lists"):
+ with console.status("[bold green]Caching Trakt..."):
trakt_watched_movies = trakt.watched_movies
trakt_watched_shows = trakt.watched_shows
trakt_movie_collection = trakt.movie_collection_set
trakt_ratings = trakt.ratings
trakt_watchlist_movies = trakt.watchlist_movies
trakt_liked_lists = trakt.liked_lists
+ console.log(f"Cached Trakt lists")
- if trakt_watchlist_movies:
- listutil.addList(None, "Trakt Watchlist", trakt_list=trakt_watchlist_movies)
+ if trakt.watchlist_movies:
+ listutil.addList(None, "Trakt Watchlist", trakt_list=trakt.watchlist_movies)
- for lst in trakt_liked_lists:
+ for lst in trakt.liked_lists:
listutil.addList(lst['username'], lst['listname'])
click.echo(f"Plex Server version: {plex.version}, updated at: {plex.updated_at}")

Use spinner from rich for trakt lists cache status