replace echo.progressbar usage with tqdm
MODIFY
plex_trakt_sync/commands/sync.py
plex_trakt_sync/commands/sync.py
import click
+from tqdm import tqdm
from plex_trakt_sync.commands.login import ensure_login
from plex_trakt_sync.factory import factory
@@ -142,7 +143,7 @@ def sync(sync_option: str, library: str, show: str, movie: str, batch_size: int)
plex = factory.plex_api()
trakt = factory.trakt_api(batch_size=batch_size)
mf = factory.media_factory(batch_size=batch_size)
- w = Walker(plex, mf, movies=movies, shows=tv, progressbar=click.progressbar)
+ w = Walker(plex, mf, movies=movies, shows=tv, progressbar=tqdm)
if library:
logger.info(f"Filtering Library: {library}")
@@ -158,7 +159,7 @@ def sync(sync_option: str, library: str, show: str, movie: str, batch_size: int)
click.echo("Nothing to sync, this is likely due conflicting options given.")
return
- w.walk_details(print=click.echo)
+ w.walk_details(print=tqdm.write)
with measure_time("Completed full sync"):
sync_all(walker=w, trakt=trakt, plex=plex)

MODIFY
plex_trakt_sync/walker.py
plex_trakt_sync/walker.py
@@ -98,11 +98,11 @@ def media_from_sections(self, sections, titles: List[str]):
for section in sections:
with measure_time(f"{section.title} processed"):
- it = self.progressbar(section.items(), length=len(section), label=f"Processing {section.title}")
+ it = self.progressbar(section.items(), total=len(section), desc=f"Processing {section.title}")
yield from it
def media_from_titles(self, libtype: str, titles: List[str]):
- it = self.progressbar(titles, label=f"Processing {libtype}s")
+ it = self.progressbar(titles, desc=f"Processing {libtype}s")
for title in it:
search = self.plex.search(title, libtype=libtype)
yield from search
@@ -118,7 +118,7 @@ def episode_from_show(self, show: Media):
def progressbar(self, iterable, **kwargs):
if self._progressbar:
- pb = self._progressbar(iterable, show_pos=True, **kwargs)
+ pb = self._progressbar(iterable, **kwargs)
with pb as it:
yield from it
else:

replace echo.progressbar usage with tqdm