Simplify loop

This commit is contained in:
tomkat83 2017-05-25 14:00:30 +02:00
parent 0c0cf342df
commit 74af562ada

View file

@ -342,7 +342,8 @@ 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:
continue
try: try:
percentComplete = float(currentPosition) / float(runtime) percentComplete = float(currentPosition) / float(runtime)
except ZeroDivisionError: except ZeroDivisionError:
@ -355,7 +356,8 @@ class Player(xbmc.Player):
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,
v.KODI_TYPE_EPISODE)):
with kodidb.GetKodiDB('video') as kodi_db: with kodidb.GetKodiDB('video') as kodi_db:
kodi_db.addPlaystate( kodi_db.addPlaystate(
data['fileid'], data['fileid'],