Add retries and update playback report to emby

This commit is contained in:
angelblue05 2017-11-25 17:34:37 -06:00
parent 6644504005
commit 354a6669ac
2 changed files with 5 additions and 5 deletions

View file

@ -43,7 +43,7 @@ class KodiMonitor(xbmc.Monitor):
def onScanFinished(self, library): def onScanFinished(self, library):
log.debug("Kodi library scan %s finished", library) log.info("Kodi library scan %s finished", library)
if library == "video": if library == "video":
window('emby_kodiScan', clear=True) window('emby_kodiScan', clear=True)
@ -74,6 +74,7 @@ class KodiMonitor(xbmc.Monitor):
return return
if method == 'Player.OnPlay': if method == 'Player.OnPlay':
self.retry = True
self._on_play_(data) self._on_play_(data)
elif method == 'VideoLibrary.OnUpdate': elif method == 'VideoLibrary.OnUpdate':

View file

@ -291,17 +291,16 @@ class Service(object):
kodi_player = self.kodi_player kodi_player = self.kodi_player
try: try:
play_time = kodi_player.getTime() play_time = kodi_player.getTime()
filename = kodi_player.currentFile filename = kodi_player.getPlayingFile()
# Update positionticks # Update positionticks
if filename in kodi_player.played_info: if filename in kodi_player.played_info and play_time > 0:
kodi_player.played_info[filename]['currentPosition'] = play_time kodi_player.played_info[filename]['currentPosition'] = play_time
difference = datetime.today() - self.last_progress difference = datetime.today() - self.last_progress
difference_seconds = difference.seconds difference_seconds = difference.seconds
# Report progress to Emby server # Report progress to Emby server
if difference_seconds > 3: if difference_seconds > 9:
kodi_player.reportPlayback() kodi_player.reportPlayback()
self.last_progress = datetime.today() self.last_progress = datetime.today()