mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-13 00:32:58 -07:00
Don't fire off session start until the item is playing (fixes double start notifications).
Don't try to write a temp session if we don't have any data.
This commit is contained in:
parent
98c0d6619a
commit
ed6ff9c10c
2 changed files with 61 additions and 59 deletions
|
@ -170,11 +170,12 @@ class ActivityHandler(object):
|
|||
ap = activity_processor.ActivityProcessor()
|
||||
db_session = ap.get_session_by_key(session_key=self.get_session_key())
|
||||
|
||||
this_state = self.timeline['state']
|
||||
this_key = str(self.timeline['ratingKey'])
|
||||
|
||||
# If we already have this session in the temp table, check for state changes
|
||||
if db_session:
|
||||
this_state = self.timeline['state']
|
||||
last_state = db_session['state']
|
||||
this_key = str(self.timeline['ratingKey'])
|
||||
last_key = str(db_session['rating_key'])
|
||||
|
||||
# Make sure the same item is being played
|
||||
|
@ -210,4 +211,5 @@ class ActivityHandler(object):
|
|||
|
||||
else:
|
||||
# We don't have this session in our table yet, start a new one.
|
||||
if this_state != 'buffering':
|
||||
self.on_start()
|
|
@ -27,7 +27,7 @@ class ActivityProcessor(object):
|
|||
self.db = database.MonitorDatabase()
|
||||
|
||||
def write_session(self, session=None):
|
||||
|
||||
if session:
|
||||
values = {'session_key': session['session_key'],
|
||||
'rating_key': session['rating_key'],
|
||||
'media_type': session['media_type'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue