Move mark_played_at

This commit is contained in:
tomkat83 2017-02-18 16:44:09 +01:00
parent c359c6fff8
commit 1a24146e48

View file

@ -21,6 +21,7 @@ import variables as v
log = logging.getLogger("PLEX."+__name__) log = logging.getLogger("PLEX."+__name__)
MARK_PLAYED_AT = 0.90
############################################################################### ###############################################################################
@ -159,12 +160,11 @@ class Items(object):
# If the playback was stopped, check whether we need to increment the # If the playback was stopped, check whether we need to increment the
# playcount. PMS won't tell us the playcount via websockets # playcount. PMS won't tell us the playcount via websockets
if item['state'] in ('stopped', 'ended'): if item['state'] in ('stopped', 'ended'):
markPlayed = 0.90
complete = float(item['viewOffset']) / float(item['duration']) complete = float(item['viewOffset']) / float(item['duration'])
log.info('Item %s stopped with completion rate %s percent.' log.info('Item %s stopped with completion rate %s percent.'
'Mark item played at %s percent.' 'Mark item played at %s percent.'
% (item['ratingKey'], str(complete), markPlayed), 1) % (item['ratingKey'], str(complete), MARK_PLAYED_AT), 1)
if complete >= markPlayed: if complete >= MARK_PLAYED_AT:
log.info('Marking as completely watched in Kodi', 1) log.info('Marking as completely watched in Kodi', 1)
try: try:
item['viewCount'] += 1 item['viewCount'] += 1