Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add printing of walk plan #300

Merged
merged 5 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions plex_trakt_sync/commands/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ def sync(sync_option: str, library: str, show: str, movie: str, batch_size: int)
if library:
logger.info(f"Filtering Library: {library}")
w.add_library(library)

if show:
w.add_show(show)
logger.info(f"Syncing Show: {show}")
elif movie:
if movie:
w.add_movie(movie)
logger.info(f"Syncing Movie: {movie}")
elif not movies and not tv:
click.echo("Nothing to sync!")

if not w.is_valid():
click.echo("Nothing to sync, this is likely due conflicting options given.")
return
else:
logger.info(f"Syncing TV={tv}, Movies={movies}")

w.walk_details(print=click.echo)

with measure_time("Completed full sync"):
sync_all(walker=w, trakt=trakt, server=server)
21 changes: 21 additions & 0 deletions plex_trakt_sync/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ def add_movie(self, movie):
self.movie.append(movie)
self.walk_shows = False

def is_valid(self):
# Single item provided
if self.library or self.movie or self.show:
return True

# Full sync of movies or shows
if self.walk_movies or self.walk_shows:
return True

return False

def walk_details(self, print=print):
print(f"Sync Movies: {self.walk_movies}")
print(f"Sync Shows: {self.walk_shows}")
if self.library:
print(f"Walk libraries: {self.library}")
if self.show:
print(f"Walk Shows: {self.show}")
if self.movie:
print(f"Walk Movies: {self.movie}")

def find_movies(self):
"""
Iterate over movie sections unless specific movie is requested
Expand Down