From a089dc6e04571a55d48f257b4cac74020e12baae Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 13 Apr 2016 16:14:55 +0200 Subject: [PATCH] Correctly stop transcoding --- resources/lib/PlexAPI.py | 5 ++--- resources/lib/player.py | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index acbfe626..ddaeac46 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -1899,15 +1899,14 @@ class API(): url += '?' + urlencode(xargs) return url - # For Direct Streaming or Transcoding - from uuid import uuid4 + # For Transcoding # Path/key to VIDEO item of xml PMS response is needed, not part path = self.item.attrib['key'] transcodePath = self.server + \ '/video/:/transcode/universal/start.m3u8?' args = { 'protocol': 'hls', # seen in the wild: 'dash', 'http', 'hls' - 'session': str(uuid4()), + 'session': clientinfo.ClientInfo().getDeviceId(), 'fastSeek': 1, 'path': path, 'mediaIndex': 0, # Probably refering to XML reply sheme diff --git a/resources/lib/player.py b/resources/lib/player.py index 16aa3544..4f0f5483 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -543,13 +543,13 @@ class Player(xbmc.Player): for item in cleanup: utils.window(item, clear=True) - # Stop transcoding - if playMethod == "Transcode": - log("Transcoding for %s terminated." % itemid, 1) - deviceId = self.clientInfo.getDeviceId() - url = "{server}/emby/Videos/ActiveEncodings?DeviceId=%s" % deviceId - doUtils(url, type="DELETE") - + # Stop transcoding + if playMethod == "Transcode": + log("Transcoding for %s terminating" % itemid, 1) + doUtils( + "{server}/video/:/transcode/universal/stop", + parameters={'session': self.clientInfo.getDeviceId()}) + self.played_info.clear() def stopPlayback(self, data):