diff --git a/Dockerfile b/Dockerfile index bee126d..c59692d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,11 @@ ENV PLEX_SERVERNAME '' ENV JELLYFIN_BASEURL '' ENV JELLYFIN_TOKEN '' +ENV SYNC_FROM_PLEX_TO_JELLYFIN 'True' +ENV SYNC_FROM_JELLYFIN_TO_PLEX 'True' +ENV SYNC_FROM_PLEX_TO_PLEX 'True' +ENV SYNC_FROM_JELLYFIN_TO_JELLYFIN 'True' + ENV BLACKLIST_LIBRARY '' ENV WHITELIST_LIBRARY '' ENV BLACKLIST_LIBRARY_TYPE '' diff --git a/src/jellyfin.py b/src/jellyfin.py index 166818b..9cc7b38 100644 --- a/src/jellyfin.py +++ b/src/jellyfin.py @@ -460,8 +460,8 @@ async def get_watched( watched = await asyncio.gather(*watched, return_exceptions=True) for user_watched in watched: - user_watched_temp = combine_watched_dicts(user_watched) - for user, user_watched_temp in user_watched_temp.items(): + user_watched_combine = combine_watched_dicts(user_watched) + for user, user_watched_temp in user_watched_combine.items(): if user not in users_watched: users_watched[user] = {} users_watched[user].update(user_watched_temp) diff --git a/src/plex.py b/src/plex.py index 205d3ac..f902742 100644 --- a/src/plex.py +++ b/src/plex.py @@ -307,10 +307,19 @@ def get_watched( if self.admin_user == user: user_plex = self.plex else: - user_plex = self.login( - self.plex._baseurl, - user.get_token(self.plex.machineIdentifier), - ) + token = user.get_token(self.plex.machineIdentifier) + if token: + user_plex = self.login( + self.plex._baseurl, + token, + ) + else: + logger( + f"Plex: Failed to get token for {user.title}, skipping", + 2, + ) + users_watched[user.title] = {} + continue libraries = user_plex.library.sections() @@ -380,11 +389,19 @@ def update_watched( ) user = self.plex.myPlexAccount().user(user) - user_plex = PlexServer( - self.plex._baseurl, - user.get_token(self.plex.machineIdentifier), - session=self.session, - ) + token = user.get_token(self.plex.machineIdentifier) + if token: + user_plex = PlexServer( + self.plex._baseurl, + token, + session=self.session, + ) + else: + logger( + f"Plex: Failed to get token for {user.title}, skipping", + 2, + ) + continue for library, videos in libraries.items(): library_other = None