From 68bf8655f354101a9ec45b24e6f7b96935f5fdce Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 10 Feb 2018 20:52:53 -0600 Subject: [PATCH] fix playback report --- resources/lib/artwork.py | 2 -- resources/lib/player.py | 7 +++---- resources/lib/read_embyserver.py | 6 +++++- resources/lib/websocket_client.py | 19 +------------------ 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index aa1701fe..32a3b809 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -488,8 +488,6 @@ class Artwork(object): artworks = item['ImageTags'] backdrops = item.get('BackdropImageTags', []) - max_height = 10000 - max_width = 10000 custom_query = "" if settings('compressArt') == "true": diff --git a/resources/lib/player.py b/resources/lib/player.py index 6a4976db..7671e15c 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -378,9 +378,8 @@ class Player(xbmc.Player): data['SubtitleStreamIndex'], postdata['SubtitleStreamIndex'] = [""] * 2 # Report progress via websocketclient - postdata = json.dumps(postdata) - log.debug("Report: %s" % postdata) - self.ws.send_progress_update(postdata) + log.debug("Report: %s", postdata) + self.emby.progress_report(postdata) @log_error() def onPlayBackPaused(self): @@ -528,7 +527,7 @@ class Player(xbmc.Player): def stop_playback(self, data): - log.debug("stop playback called.") + log.info("stop playback called.") position_ticks = int(data['currentPosition'] * 10000000) position = data['runtime'] if position_ticks and window('emby.external') else position_ticks diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index f93548ef..34d5d857 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -673,7 +673,7 @@ class Read_EmbyServer(): def stop_playback(self, item_id, position, playsession_id, mediasource_id=None): - url = self.get_emby_url('/Sessions/Playing/Stopped') + url = self.get_emby_url('Sessions/Playing/Stopped') return self.doUtils.downloadUrl(url, action_type="POST", postBody={ 'ItemId': item_id, @@ -681,3 +681,7 @@ class Read_EmbyServer(): 'PositionTicks': position, 'PlaySessionId': playsession_id }) + + def progress_report(self, data): + url = self.get_emby_url('Sessions/Playing/Progress') + return self.doUtils.downloadUrl(url, action_type="POST", postBody=data) diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index 9f9e383e..a2119e98 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -45,23 +45,6 @@ class WebSocketClient(threading.Thread): threading.Thread.__init__(self) - - def send_progress_update(self, data): - - log.debug("sendProgressUpdate") - try: - message = { - - 'MessageType': "ReportPlaybackProgress", - 'Data': data - } - message_str = json.dumps(message) - self._client.send(message_str) - log.debug("Message data: %s", message_str) - - except Exception as error: - log.exception(error) - @log_error() def on_message(self, ws, message): @@ -364,7 +347,7 @@ class WebSocketClient(threading.Thread): if self._stop_websocket: break - if self.monitor.waitForAbort(10): + if self.monitor.waitForAbort(5): # Abort was requested, exit break