Merge pull request #1169 from croneter/fix-external-player

Fix PKC incorrectly marking a video as unwatched if an external player has been used
This commit is contained in:
croneter 2020-05-07 14:06:38 +02:00 committed by GitHub
commit c7480339cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,9 +409,15 @@ def _record_playstate(status, ended):
return return
totaltime = float(timing.kodi_time_to_millis(status['totaltime'])) / 1000 totaltime = float(timing.kodi_time_to_millis(status['totaltime'])) / 1000
if status['external_player']: if status['external_player']:
_external_player_correct_plex_watch_count(db_item) # video has either been entirely watched - or not.
progress = 0.0 # "ended" won't work, need a workaround
time = 0.0 ended = _external_player_correct_plex_watch_count(db_item)
if ended:
progress = 0.99
time = v.IGNORE_SECONDS_AT_START + 1
else:
progress = 0.0
time = 0.0
else: else:
if ended: if ended:
progress = 0.99 progress = 0.99
@ -479,6 +485,7 @@ def _external_player_correct_plex_watch_count(db_item):
playcount = kodidb.get_playcount(db_item['kodi_fileid']) playcount = kodidb.get_playcount(db_item['kodi_fileid'])
LOG.debug('External player detected. Playcount: %s', playcount) LOG.debug('External player detected. Playcount: %s', playcount)
PF.scrobble(db_item['plex_id'], 'watched' if playcount else 'unwatched') PF.scrobble(db_item['plex_id'], 'watched' if playcount else 'unwatched')
return True if playcount else False
def _clean_file_table(): def _clean_file_table():