mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 13:23:24 -07:00
Group watched history sessions based on credits markers
This commit is contained in:
parent
b2b12044e3
commit
c5005c1ea9
1 changed files with 7 additions and 9 deletions
|
@ -327,7 +327,7 @@ class ActivityProcessor(object):
|
|||
# Get the last insert row id
|
||||
last_id = self.db.last_insert_id()
|
||||
new_session = prev_session = None
|
||||
prev_progress_percent = media_watched_percent = 0
|
||||
watched = False
|
||||
|
||||
if session['live']:
|
||||
# Check if we should group the session, select the last guid from the user
|
||||
|
@ -369,12 +369,11 @@ class ActivityProcessor(object):
|
|||
'view_offset': result[1]['view_offset'],
|
||||
'reference_id': result[1]['reference_id']}
|
||||
|
||||
watched_percent = {'movie': plexpy.CONFIG.MOVIE_WATCHED_PERCENT,
|
||||
'episode': plexpy.CONFIG.TV_WATCHED_PERCENT,
|
||||
'track': plexpy.CONFIG.MUSIC_WATCHED_PERCENT
|
||||
}
|
||||
prev_progress_percent = helpers.get_percent(prev_session['view_offset'], session['duration'])
|
||||
media_watched_percent = watched_percent.get(session['media_type'], 0)
|
||||
marker_first, marker_final = helpers.get_first_final_marker(metadata['markers'])
|
||||
watched = helpers.check_watched(
|
||||
session['media_type'], session['view_offset'], session['duration'],
|
||||
marker_first, marker_final
|
||||
)
|
||||
|
||||
query = 'UPDATE session_history SET reference_id = ? WHERE id = ? '
|
||||
|
||||
|
@ -384,8 +383,7 @@ class ActivityProcessor(object):
|
|||
# else set the reference_id to the new id
|
||||
if prev_session is None and new_session is None:
|
||||
args = [last_id, last_id]
|
||||
elif prev_progress_percent < media_watched_percent and \
|
||||
prev_session['view_offset'] <= new_session['view_offset'] or \
|
||||
elif watched and prev_session['view_offset'] <= new_session['view_offset'] or \
|
||||
session['live'] and prev_session['guid'] == new_session['guid']:
|
||||
args = [prev_session['reference_id'], new_session['id']]
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue