fix playback report

This commit is contained in:
angelblue05 2018-02-10 20:52:53 -06:00
parent 93525652ae
commit 68bf8655f3
4 changed files with 9 additions and 25 deletions

View file

@ -488,8 +488,6 @@ class Artwork(object):
artworks = item['ImageTags'] artworks = item['ImageTags']
backdrops = item.get('BackdropImageTags', []) backdrops = item.get('BackdropImageTags', [])
max_height = 10000
max_width = 10000
custom_query = "" custom_query = ""
if settings('compressArt') == "true": if settings('compressArt') == "true":

View file

@ -378,9 +378,8 @@ class Player(xbmc.Player):
data['SubtitleStreamIndex'], postdata['SubtitleStreamIndex'] = [""] * 2 data['SubtitleStreamIndex'], postdata['SubtitleStreamIndex'] = [""] * 2
# Report progress via websocketclient # Report progress via websocketclient
postdata = json.dumps(postdata) log.debug("Report: %s", postdata)
log.debug("Report: %s" % postdata) self.emby.progress_report(postdata)
self.ws.send_progress_update(postdata)
@log_error() @log_error()
def onPlayBackPaused(self): def onPlayBackPaused(self):
@ -528,7 +527,7 @@ class Player(xbmc.Player):
def stop_playback(self, data): def stop_playback(self, data):
log.debug("stop playback called.") log.info("stop playback called.")
position_ticks = int(data['currentPosition'] * 10000000) position_ticks = int(data['currentPosition'] * 10000000)
position = data['runtime'] if position_ticks and window('emby.external') else position_ticks position = data['runtime'] if position_ticks and window('emby.external') else position_ticks

View file

@ -673,7 +673,7 @@ class Read_EmbyServer():
def stop_playback(self, item_id, position, playsession_id, mediasource_id=None): 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={ return self.doUtils.downloadUrl(url, action_type="POST", postBody={
'ItemId': item_id, 'ItemId': item_id,
@ -681,3 +681,7 @@ class Read_EmbyServer():
'PositionTicks': position, 'PositionTicks': position,
'PlaySessionId': playsession_id '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)

View file

@ -45,23 +45,6 @@ class WebSocketClient(threading.Thread):
threading.Thread.__init__(self) 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() @log_error()
def on_message(self, ws, message): def on_message(self, ws, message):
@ -364,7 +347,7 @@ class WebSocketClient(threading.Thread):
if self._stop_websocket: if self._stop_websocket:
break break
if self.monitor.waitForAbort(10): if self.monitor.waitForAbort(5):
# Abort was requested, exit # Abort was requested, exit
break break