From b8185afdf98a8f977281b5cea31518e0dda5f10f Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:09:35 -0700 Subject: [PATCH] Temporary fix for live tv session missing duration --- plexpy/activity_handler.py | 3 ++- plexpy/activity_processor.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plexpy/activity_handler.py b/plexpy/activity_handler.py index 2507cf6f..ea25f0bd 100644 --- a/plexpy/activity_handler.py +++ b/plexpy/activity_handler.py @@ -163,7 +163,8 @@ class ActivityHandler(object): # Set force_stop to true to disable the state set if not force_stop: # Set the view offset equal to the duration if it is within the last 10 seconds - if self.db_session['duration'] - self.view_offset <= 10000: + # TODO: temporary workaround for missing livetv duration + if self.db_session['duration'] > 0 and self.db_session['duration'] - self.view_offset <= 10000: view_offset = self.db_session['duration'] else: view_offset = self.view_offset diff --git a/plexpy/activity_processor.py b/plexpy/activity_processor.py index 9115f332..3ece3f11 100644 --- a/plexpy/activity_processor.py +++ b/plexpy/activity_processor.py @@ -78,7 +78,8 @@ class ActivityProcessor(object): 'added_at': session.get('added_at', ''), 'guid': session.get('guid', ''), 'view_offset': session.get('view_offset', ''), - 'duration': session.get('duration', ''), + # TODO: temporary workaround for missing livetv duration + 'duration': session.get('duration', '') or 0, 'video_decision': session.get('video_decision', ''), 'audio_decision': session.get('audio_decision', ''), 'transcode_decision': session.get('transcode_decision', ''),