Threaded Plex Companion Timeline messages, due to PMS missing Content-Length header args in the response

This commit is contained in:
tomkat83 2016-02-11 10:35:16 +01:00
parent 39f1d0c367
commit a64e36cf69

View file

@ -242,13 +242,19 @@ class Subscriber:
printDebug("sending xml to subscriber %s: %s" % (self.tostr(), msg)) printDebug("sending xml to subscriber %s: %s" % (self.tostr(), msg))
url = self.protocol + '://' + self.host + ':' + self.port \ url = self.protocol + '://' + self.host + ':' + self.port \
+ "/:/timeline" + "/:/timeline"
t = threading.Thread(target=self.threadedSend, args=(url, msg))
t.start()
def threadedSend(self, url, msg):
"""
Threaded POST request, because they stall due to PMS response missing
the Content-Length header :-(
"""
response = self.download.downloadUrl( response = self.download.downloadUrl(
url, url,
postBody=msg, postBody=msg,
type="POSTXML") type="POSTXML")
# if not requests.post(self.host, self.port, "/:/timeline", msg, getPlexHeaders(), self.protocol):
# subMgr.removeSubscriber(self.uuid)
if response in [False, None, 401]: if response in [False, None, 401]:
subMgr.removeSubscriber(self.uuid) subMgr.removeSubscriber(self.uuid)
subMgr = SubscriptionManager() subMgr = SubscriptionManager()