diff --git a/plextraktsync/config.default.yml b/plextraktsync/config.default.yml index ea78aece33..6c10589df2 100644 --- a/plextraktsync/config.default.yml +++ b/plextraktsync/config.default.yml @@ -84,6 +84,8 @@ watch: username_filter: true # Show the progress bar of played media in terminal media_progressbar: true + # Clients to ignore when listening Play events + ignore_clients: ~ xbmc-providers: movies: imdb diff --git a/plextraktsync/watch/WatchStateUpdater.py b/plextraktsync/watch/WatchStateUpdater.py index 140655135e..0d8ed7102a 100644 --- a/plextraktsync/watch/WatchStateUpdater.py +++ b/plextraktsync/watch/WatchStateUpdater.py @@ -47,6 +47,10 @@ def username_filter(self): self.logger.warning("No permission to access sessions, disabling username filter") return None + @cached_property + def ignore_clients(self): + return self.config["watch"]["ignore_clients"] or [] + @cached_property def progressbar(self): if not self.config["watch"]["media_progressbar"]: @@ -170,6 +174,10 @@ def on_play(self, event: PlaySessionStateNotification): self.logger.debug(f"Scrobbled: {scrobbled}") def can_scrobble(self, event: PlaySessionStateNotification): + if self.ignore_clients: + if event.client_identifier in self.ignore_clients: + return False + if not self.username_filter: return True diff --git a/plextraktsync/watch/events.py b/plextraktsync/watch/events.py index 7010ab0ca7..5a6e501d65 100644 --- a/plextraktsync/watch/events.py +++ b/plextraktsync/watch/events.py @@ -70,6 +70,10 @@ def state(self): def session_key(self): return self["sessionKey"] + @property + def client_identifier(self): + return self["clientIdentifier"] + class Setting(Event): pass