From a43efef28af374e9e698b9562badb361676fcefc Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Thu, 10 Sep 2015 21:30:34 -0700 Subject: [PATCH] Fix write session to history only if library item Some channel items, specifically Apple movie trailers, are counted as movie items. Make sure the rating_key is a number to filter these out. --- plexpy/monitor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plexpy/monitor.py b/plexpy/monitor.py index c6d52936..478f2e78 100644 --- a/plexpy/monitor.py +++ b/plexpy/monitor.py @@ -151,7 +151,9 @@ def check_active_sessions(): kwargs=dict(stream_data=stream, notify_action='stop')).start() # Write the item history on playback stop - monitor_process.write_session_history(session=stream) + # Just make sure that the ratingKey is indeed an integer + if stream['rating_key'].isdigit(): + monitor_process.write_session_history(session=stream) # Process the newly received session data for session in media_container: