diff --git a/plexpy/activity_pinger.py b/plexpy/activity_pinger.py index 2eb63bbe..6cf12443 100644 --- a/plexpy/activity_pinger.py +++ b/plexpy/activity_pinger.py @@ -127,7 +127,8 @@ def check_active_sessions(ws_request=False): kwargs=dict(stream_data=stream, notify_action='buffer')).start() logger.debug(u"PlexPy Monitor :: Stream buffering. Count is now %s. Last triggered %s." - % (buffer_values[0][0], buffer_values[0][1])) + % (buffer_values[0]['buffer_count'], + buffer_values[0]['buffer_last_triggered'])) # Check if the user has reached the offset in the media we defined as the "watched" percent # Don't trigger if state is buffer as some clients push the progress to the end when diff --git a/plexpy/activity_processor.py b/plexpy/activity_processor.py index fb1a2376..3f7927fc 100644 --- a/plexpy/activity_processor.py +++ b/plexpy/activity_processor.py @@ -180,18 +180,18 @@ class ActivityProcessor(object): result = self.db.select(query=query, args=args) - new_session = {'id': result[0][0], - 'rating_key': result[0][1], - 'user_id': result[0][2], - 'reference_id': result[0][3]} + new_session = {'id': result[0]['id'], + 'rating_key': result[0]['rating_key'], + 'user_id': result[0]['user_id'], + 'reference_id': result[0]['reference_id']} if len(result) == 1: prev_session = None else: - prev_session = {'id': result[1][0], - 'rating_key': result[1][1], - 'user_id': result[1][2], - 'reference_id': result[1][3]} + prev_session = {'id': result[1]['id'], + 'rating_key': result[1]['rating_key'], + 'user_id': result[1]['user_id'], + 'reference_id': result[1]['reference_id']} query = 'UPDATE session_history SET reference_id = ? WHERE id = ? ' # If rating_key is the same in the previous session, then set the reference_id to the previous row, else set the reference_id to the new id diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 2f91a5df..eaa8b777 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -214,13 +214,13 @@ def get_notify_state(session): args=[session['session_key'], session['rating_key'], session['user']]) notify_states = [] for item in result: - notify_state = {'on_play': item[0], - 'on_stop': item[1], - 'on_pause': item[2], - 'on_resume': item[3], - 'on_buffer': item[4], - 'on_watched': item[5], - 'agent_id': item[6]} + notify_state = {'on_play': item['on_play'], + 'on_stop': item['on_stop'], + 'on_pause': item['on_pause'], + 'on_resume': item['on_resume'], + 'on_buffer': item['on_buffer'], + 'on_watched': item['on_watched'], + 'agent_id': item['agent_id']} notify_states.append(notify_state) return notify_states @@ -234,8 +234,8 @@ def get_notify_state_timeline(timeline): args=[timeline['rating_key']]) notify_states = [] for item in result: - notify_state = {'on_created': item[0], - 'agent_id': item[1]} + notify_state = {'on_created': item['on_created'], + 'agent_id': item['agent_id']} notify_states.append(notify_state) return notify_states