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
|
# Get the last insert row id
|
||||||
last_id = self.db.last_insert_id()
|
last_id = self.db.last_insert_id()
|
||||||
new_session = prev_session = None
|
new_session = prev_session = None
|
||||||
prev_progress_percent = media_watched_percent = 0
|
watched = False
|
||||||
|
|
||||||
if session['live']:
|
if session['live']:
|
||||||
# Check if we should group the session, select the last guid from the user
|
# 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'],
|
'view_offset': result[1]['view_offset'],
|
||||||
'reference_id': result[1]['reference_id']}
|
'reference_id': result[1]['reference_id']}
|
||||||
|
|
||||||
watched_percent = {'movie': plexpy.CONFIG.MOVIE_WATCHED_PERCENT,
|
marker_first, marker_final = helpers.get_first_final_marker(metadata['markers'])
|
||||||
'episode': plexpy.CONFIG.TV_WATCHED_PERCENT,
|
watched = helpers.check_watched(
|
||||||
'track': plexpy.CONFIG.MUSIC_WATCHED_PERCENT
|
session['media_type'], session['view_offset'], session['duration'],
|
||||||
}
|
marker_first, marker_final
|
||||||
prev_progress_percent = helpers.get_percent(prev_session['view_offset'], session['duration'])
|
)
|
||||||
media_watched_percent = watched_percent.get(session['media_type'], 0)
|
|
||||||
|
|
||||||
query = 'UPDATE session_history SET reference_id = ? WHERE id = ? '
|
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
|
# else set the reference_id to the new id
|
||||||
if prev_session is None and new_session is None:
|
if prev_session is None and new_session is None:
|
||||||
args = [last_id, last_id]
|
args = [last_id, last_id]
|
||||||
elif prev_progress_percent < media_watched_percent and \
|
elif watched and prev_session['view_offset'] <= new_session['view_offset'] or \
|
||||||
prev_session['view_offset'] <= new_session['view_offset'] or \
|
|
||||||
session['live'] and prev_session['guid'] == new_session['guid']:
|
session['live'] and prev_session['guid'] == new_session['guid']:
|
||||||
args = [prev_session['reference_id'], new_session['id']]
|
args = [prev_session['reference_id'], new_session['id']]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue