More dict key fixes.

This commit is contained in:
Tim 2015-12-06 17:19:09 +02:00
parent ba68a9b52b
commit a5bd7e6563
3 changed files with 19 additions and 18 deletions

View file

@ -127,7 +127,8 @@ def check_active_sessions(ws_request=False):
kwargs=dict(stream_data=stream, notify_action='buffer')).start() kwargs=dict(stream_data=stream, notify_action='buffer')).start()
logger.debug(u"PlexPy Monitor :: Stream buffering. Count is now %s. Last triggered %s." 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 # 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 # Don't trigger if state is buffer as some clients push the progress to the end when

View file

@ -180,18 +180,18 @@ class ActivityProcessor(object):
result = self.db.select(query=query, args=args) result = self.db.select(query=query, args=args)
new_session = {'id': result[0][0], new_session = {'id': result[0]['id'],
'rating_key': result[0][1], 'rating_key': result[0]['rating_key'],
'user_id': result[0][2], 'user_id': result[0]['user_id'],
'reference_id': result[0][3]} 'reference_id': result[0]['reference_id']}
if len(result) == 1: if len(result) == 1:
prev_session = None prev_session = None
else: else:
prev_session = {'id': result[1][0], prev_session = {'id': result[1]['id'],
'rating_key': result[1][1], 'rating_key': result[1]['rating_key'],
'user_id': result[1][2], 'user_id': result[1]['user_id'],
'reference_id': result[1][3]} 'reference_id': result[1]['reference_id']}
query = 'UPDATE session_history SET reference_id = ? WHERE 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 # 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

View file

@ -214,13 +214,13 @@ def get_notify_state(session):
args=[session['session_key'], session['rating_key'], session['user']]) args=[session['session_key'], session['rating_key'], session['user']])
notify_states = [] notify_states = []
for item in result: for item in result:
notify_state = {'on_play': item[0], notify_state = {'on_play': item['on_play'],
'on_stop': item[1], 'on_stop': item['on_stop'],
'on_pause': item[2], 'on_pause': item['on_pause'],
'on_resume': item[3], 'on_resume': item['on_resume'],
'on_buffer': item[4], 'on_buffer': item['on_buffer'],
'on_watched': item[5], 'on_watched': item['on_watched'],
'agent_id': item[6]} 'agent_id': item['agent_id']}
notify_states.append(notify_state) notify_states.append(notify_state)
return notify_states return notify_states
@ -234,8 +234,8 @@ def get_notify_state_timeline(timeline):
args=[timeline['rating_key']]) args=[timeline['rating_key']])
notify_states = [] notify_states = []
for item in result: for item in result:
notify_state = {'on_created': item[0], notify_state = {'on_created': item['on_created'],
'agent_id': item[1]} 'agent_id': item['agent_id']}
notify_states.append(notify_state) notify_states.append(notify_state)
return notify_states return notify_states