def subscribe(self, path, arguments): sub = self.getSubFromRequest(arguments) if sub: remoteSubscriberManager.addSubscriber(sub) self.send_end() timelineManager.SendTimelineToSubscriber(sub)
def poll(self, path, arguments): uuid = self.headers.get("X-Plex-Client-Identifier", None) name = self.headers.get("X-Plex-Device-Name", "") commandID = -1 try: commandID = int(arguments.get("commandID", -1)) except: pass if commandID == -1 or not uuid: log.warn("HttpHandler::poll the poller needs to set both X-Plex-Client-Identifier header and commandID arguments.") self.setStandardResponse(500, "You need to specify both x-Plex-Client-Identifier as a header and commandID as a argument") return pollSubscriber = RemoteSubscriber(uuid, commandID, name=name) remoteSubscriberManager.addSubscriber(pollSubscriber) if arguments.has_key("wait") and arguments["wait"] in ("1", "true"): self.xmlOutput = timelineManager.WaitForTimeline(pollSubscriber) else: self.xmlOutput = timelineManager.GetCurrentTimeLinesXML(pollSubscriber) self.send_header("Access-Control-Expose-Headers", "X-Plex-Client-Identifier")