From 200f501b1257c8fb44c51d325626594f8a549847 Mon Sep 17 00:00:00 2001 From: RemiRigal Date: Fri, 29 Apr 2022 14:06:14 +0200 Subject: [PATCH] Add username to changes from scheduler --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 8d98c2e..5aff970 100644 --- a/main.py +++ b/main.py @@ -261,8 +261,11 @@ def scheduler_callback(self): min_date = datetime.now() - timedelta(days=1) history = self.plex.history(mindate=min_date) for episode in [media for media in history if isinstance(media, Episode)]: + user = PlexUtils.get_user_from_user_id(self.plex, episode.accountID) + if user is None: + continue episode.reload() - self.change_default_tracks_if_needed(None, episode) + self.change_default_tracks_if_needed(user.name, episode) def change_default_tracks_if_needed(self, username: str, episode: Episode, episodes: List[Episode] = None): logger.debug(f"[Language Update] "