Move MARK_PLAYED_AT to variables.py
This commit is contained in:
parent
ee9be516aa
commit
aa83776a8b
3 changed files with 5 additions and 7 deletions
|
@ -22,7 +22,6 @@ import state
|
||||||
|
|
||||||
log = logging.getLogger("PLEX."+__name__)
|
log = logging.getLogger("PLEX."+__name__)
|
||||||
|
|
||||||
MARK_PLAYED_AT = 0.90
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,8 +167,8 @@ class Items(object):
|
||||||
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), MARK_PLAYED_AT), 1)
|
% (item['ratingKey'], str(complete), v.MARK_PLAYED_AT), 1)
|
||||||
if complete >= MARK_PLAYED_AT:
|
if complete >= v.MARK_PLAYED_AT:
|
||||||
log.info('Marking as completely watched in Kodi')
|
log.info('Marking as completely watched in Kodi')
|
||||||
try:
|
try:
|
||||||
item['viewCount'] += 1
|
item['viewCount'] += 1
|
||||||
|
|
|
@ -347,11 +347,9 @@ class Player(xbmc.Player):
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
# Runtime is 0.
|
# Runtime is 0.
|
||||||
percentComplete = 0
|
percentComplete = 0
|
||||||
|
|
||||||
markPlayed = 0.90
|
|
||||||
log.info("Percent complete: %s Mark played at: %s"
|
log.info("Percent complete: %s Mark played at: %s"
|
||||||
% (percentComplete, markPlayed))
|
% (percentComplete, v.MARK_PLAYED_AT))
|
||||||
if percentComplete >= markPlayed:
|
if percentComplete >= v.MARK_PLAYED_AT:
|
||||||
# Kodi seems to sometimes overwrite our playstate, so wait
|
# Kodi seems to sometimes overwrite our playstate, so wait
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(500)
|
||||||
# Tell Kodi that we've finished watching (Plex knows)
|
# Tell Kodi that we've finished watching (Plex knows)
|
||||||
|
|
|
@ -21,6 +21,7 @@ def tryDecode(string, encoding='utf-8'):
|
||||||
string = string.decode()
|
string = string.decode()
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
MARK_PLAYED_AT = 0.9
|
||||||
|
|
||||||
_ADDON = Addon()
|
_ADDON = Addon()
|
||||||
ADDON_NAME = 'PlexKodiConnect'
|
ADDON_NAME = 'PlexKodiConnect'
|
||||||
|
|
Loading…
Reference in a new issue