From a64e36cf6969460c657ffcbf0a2ed1206272c35d Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 11 Feb 2016 10:35:16 +0100 Subject: [PATCH] Threaded Plex Companion Timeline messages, due to PMS missing Content-Length header args in the response --- resources/lib/plexbmchelper/subscribers.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/lib/plexbmchelper/subscribers.py b/resources/lib/plexbmchelper/subscribers.py index 12ca0d33..4bc9a3b1 100644 --- a/resources/lib/plexbmchelper/subscribers.py +++ b/resources/lib/plexbmchelper/subscribers.py @@ -242,13 +242,19 @@ class Subscriber: printDebug("sending xml to subscriber %s: %s" % (self.tostr(), msg)) url = self.protocol + '://' + self.host + ':' + self.port \ + "/:/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( url, postBody=msg, 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]: subMgr.removeSubscriber(self.uuid) -subMgr = SubscriptionManager() + +subMgr = SubscriptionManager()