Simplify loop
This commit is contained in:
parent
0c0cf342df
commit
74af562ada
1 changed files with 22 additions and 20 deletions
|
@ -342,27 +342,29 @@ class Player(xbmc.Player):
|
||||||
# Prevent manually mark as watched in Kodi monitor
|
# Prevent manually mark as watched in Kodi monitor
|
||||||
window('plex_skipWatched%s' % itemid, value="true")
|
window('plex_skipWatched%s' % itemid, value="true")
|
||||||
|
|
||||||
if currentPosition and runtime:
|
if not currentPosition or not runtime:
|
||||||
try:
|
continue
|
||||||
percentComplete = float(currentPosition) / float(runtime)
|
try:
|
||||||
except ZeroDivisionError:
|
percentComplete = float(currentPosition) / float(runtime)
|
||||||
# Runtime is 0.
|
except ZeroDivisionError:
|
||||||
percentComplete = 0
|
# Runtime is 0.
|
||||||
|
percentComplete = 0
|
||||||
|
|
||||||
markPlayed = 0.90
|
markPlayed = 0.90
|
||||||
log.info("Percent complete: %s Mark played at: %s"
|
log.info("Percent complete: %s Mark played at: %s"
|
||||||
% (percentComplete, markPlayed))
|
% (percentComplete, markPlayed))
|
||||||
if percentComplete >= markPlayed:
|
if percentComplete >= markPlayed:
|
||||||
# Tell Kodi that we've finished watching (Plex knows)
|
# Tell Kodi that we've finished watching (Plex knows)
|
||||||
if (data['fileid'] is not None and
|
if (data['fileid'] is not None and
|
||||||
data['itemType'] in (v.KODI_TYPE_MOVIE, v.KODI_TYPE_EPISODE)):
|
data['itemType'] in (v.KODI_TYPE_MOVIE,
|
||||||
with kodidb.GetKodiDB('video') as kodi_db:
|
v.KODI_TYPE_EPISODE)):
|
||||||
kodi_db.addPlaystate(
|
with kodidb.GetKodiDB('video') as kodi_db:
|
||||||
data['fileid'],
|
kodi_db.addPlaystate(
|
||||||
None,
|
data['fileid'],
|
||||||
None,
|
None,
|
||||||
data['playcount'] + 1,
|
None,
|
||||||
DateToKodi(getUnixTimestamp()))
|
data['playcount'] + 1,
|
||||||
|
DateToKodi(getUnixTimestamp()))
|
||||||
|
|
||||||
# Clean the WINDOW properties
|
# Clean the WINDOW properties
|
||||||
for filename in self.played_info:
|
for filename in self.played_info:
|
||||||
|
|
Loading…
Reference in a new issue