def keyYellow(self): printl("", self, "S") if self.useMappings: serverID = self.currentId self.session.open(DPS_Mappings, serverID) elif self.current.localAuth.value: # now that we know the server we establish global plexInstance self.plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.current)) ipInConfig = "%d.%d.%d.%d" % tuple(self.current.ip.value) token = self.plexInstance.getPlexUserTokenForLocalServerAuthentication( ipInConfig) if token: self.current.myplexLocalToken.value = token self.current.myplexLocalToken.save() self.session.open( MessageBox, (_("Local Token:") + "\n%s \n" + _("for the user:"******"\n%s") % (token, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO) else: response = self.plexInstance.getLastResponse() self.session.open( MessageBox, (_("Error:") + "\n%s \n" + _("for the user:"******"\n%s") % (response, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO) printl("", self, "C")
def keyBlue(self): printl("", self, "S") # now that we know the server we establish global plexInstance self.plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.current)) token = self.plexInstance.getNewMyPlexToken() if token: self.session.openWithCallback( self.saveNow, MessageBox, (_("myPlex Token:") + "\n%s \n" + _("for the user:"******"\n%s \n" + _("with the id:") + "\n%s") % (token, self.current.myplexTokenUsername.value, self.current.myplexId.value), MessageBox.TYPE_INFO) else: response = self.plexInstance.getLastResponse() self.session.openWithCallback( self.saveNow, MessageBox, (_("Error:") + "\n%s \n" + _("for the user:"******"\n%s") % (response, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO) printl("", self, "C")
def __init__(self, session, mode, serverConfig=None): Screen.__init__(self, session) DPH_ScreenHelper.__init__(self) DPH_PlexScreen.__init__(self) self.guiElements = getGuiElements() self.initScreen("syncer") self.serverConfig = serverConfig self.resolution = getSkinResolution() if serverConfig is not None: # now that we know the server we establish global plexInstance self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.serverConfig)) # we are "sync" or "render" self._mode = mode # we use the global g_mediaSyncerInfo.instance to take care only having one instance self.mediaSyncerInfo = g_mediaSyncerInfo.instance self["output"] = ScrollLabel() self["progress"] = Label() # we use this counter to reset scorll label every x entries to stay responsive self.counter = 0 self["btn_greenText"] = Label() if self._mode == "sync": self["btn_greenText"].setText(_("Start Sync")) else: self["btn_greenText"].setText(_("Start Rendering")) self["btn_green"] = Pixmap() self["btn_blueText"] = Label() self["btn_blueText"].setText(_("Background")) self["btn_blue"] = Pixmap() self["btn_redText"] = Label() self["btn_redText"].setText(_("Abort")) self["btn_red"] = Pixmap() self["setupActions"] = ActionMap(["DPS_Syncer"], { "red": self.keyRed, "blue": self.keyBlue, "yellow": self.keyYellow, "green": self.keyGreen, "bouquet_up": self.keyBouquetUp, "bouquet_down": self.keyBouquetDown, "cancel": self.exit, }, -2) self.onFirstExecBegin.append(self.startup) self.onShown.append(self.finishLayout) self.onClose.append(self.__onClose)
def keyRed(self): printl("", self, "S") if self.useHomeUsers: serverID = self.currentId plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.current)) self.session.open(DPS_Users, serverID, plexInstance) #self.session.open(MessageBox,(_("myPlex Token:") + "\n%s \n" + _("myPlex Localtoken:") + "\n%s \n"+ _("for the user:"******"\n%s") % (self.current.myplexToken.value, self.current.myplexLocalToken.value, self.current.myplexTokenUsername.value), MessageBox.TYPE_INFO) printl("", self, "C")
def keySave(self, stayOpen=False): printl("", self, "S") if self.newmode == 1: config.plugins.dreamplex.entriescount.value += 1 config.plugins.dreamplex.entriescount.save() #if self.current.machineIdentifier.value == "": from DP_PlexLibrary import PlexLibrary self.plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.current)) machineIdentifiers = "" if self.current.connectionType.value == "2": xmlResponse = self.plexInstance.getSharedServerForPlexUser() machineIdentifier = xmlResponse.get("machineIdentifier") if machineIdentifier is not None: machineIdentifiers += machineIdentifier servers = xmlResponse.findall("Server") for server in servers: machineIdentifier = server.get("machineIdentifier") if machineIdentifier is not None: machineIdentifiers += ", " + machineIdentifier else: xmlResponse = self.plexInstance.getXmlTreeFromUrl( "http://" + self.plexInstance.g_currentServer) machineIdentifier = xmlResponse.get("machineIdentifier") if machineIdentifier is not None: machineIdentifiers += xmlResponse.get("machineIdentifier") self.current.machineIdentifier.value = machineIdentifiers printl( "machineIdentifier: " + str(self.current.machineIdentifier.value), self, "D") config.plugins.dreamplex.entriescount.save() config.plugins.dreamplex.Entries.save() config.plugins.dreamplex.save() configfile.save() if not stayOpen: self.close() printl("", self, "C")
def okbuttonClick(self): printl("", self, "S") # this is used to step in directly into a server when there is only one entry in the serverlist if self.selectionOverride is not None: selection = self.selectionOverride # because we change the screen we have to unset the information to be able to return to main menu self.selectionOverride = None else: selection = self["menu"].getCurrent() printl("selection = " + str(selection), self, "D") if selection is not None: self.selectedEntry = selection[1] printl("selected entry " + str(self.selectedEntry), self, "D") if type(self.selectedEntry) is int: printl("selected entry is int", self, "D") if self.selectedEntry == Plugin.MENU_MAIN: printl("found Plugin.MENU_MAIN", self, "D") self["menu"].setList(self.menu_main_list) elif self.selectedEntry == Plugin.MENU_SERVER: printl("found Plugin.MENU_SERVER", self, "D") self.g_serverConfig = selection[3] # now that we know the server we establish global plexInstance self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.g_serverConfig)) # check if server is reachable self.checkServerState() elif self.selectedEntry == Plugin.MENU_SYSTEM: printl("found Plugin.MENU_SYSTEM", self, "D") self["menu"].setList(self.getSettingsMenu()) self.setTitle(_("System")) self.refreshMenu() if self.g_horizontal_menu: self.refreshOrientationHorMenu(0) elif type(self.selectedEntry) is str: printl("selected entry is string", self, "D") if selection[1] == "DPS_Settings": self.session.open(DPS_Settings) elif selection[1] == "DPS_Server": self.session.open(DPS_Server) elif selection[1] == "DPS_SystemCheck": self.session.open(DPS_SystemCheck) elif selection[1] == "DPS_About": self.session.open(DPS_About) elif selection[1] == "LiveTv": self.exit() elif selection[1] == "DPS_Syncer": self.session.open(DPS_Syncer, "render") else: pass printl("", self, "C")
def answer_request(self): printl("", self, "S") try: self.send_response(200) self.setAccessControlHeaders() request_path = self.path[1:] request_path = re.sub(r"\?.*", "", request_path) printl("request path is: [%s]" % request_path, self, "D") if request_path == "player/timeline/poll": sleep(10) xml = "<MediaContainer location='navigation' commandID='10'><Timeline state='stopped' time='0' type='music' /><Timeline state='stopped' time='0' type='video' /><Timeline state='stopped' time='0' type='photo' /></MediaContainer>" self.setXmlHeader(xml) self.end_headers() self.wfile.write(xml) elif request_path == "resources": xml = self.getResourceXml() self.setXmlHeader(xml) self.end_headers() self.wfile.write(xml) elif request_path == "player/timeline/subscribe": xml = "<MediaContainer location='navigation' commandID='10'><Timeline state='stopped' time='0' type='music' /><Timeline state='stopped' time='0' type='video' /><Timeline state='stopped' time='0' type='photo' /></MediaContainer>" self.setXmlHeader(xml) self.end_headers() self.wfile.write(xml) elif request_path == "player/playback/seekTo": params = self.getParams() offset = params["offset"][0] elif request_path == "player/playback/setParameters": params = self.getParams() volume = params["volume"][0] url = "http://localhost/web/vol?set=set" + str(volume) urllib.urlopen(url) self.send_response(200) elif request_path == "/player/playback/pause": url = "http://localhost/web/remotecontrol?command=400" urllib.urlopen(url) xml = "<MediaContainer location='navigation' commandID='10'><Timeline state='paused' time='0' type='music' /><Timeline state='paused' time='0' type='video' /><Timeline state='paused' time='0' type='photo' /></MediaContainer>" self.setXmlHeader(xml) self.end_headers() self.wfile.write(xml) elif request_path == "player/playback/stop": url = "http://localhost/web/remotecontrol?command=377" urllib.urlopen(url) self.send_response(200) elif request_path == "player/playback/skipNext": url = "http://localhost/web/remotecontrol?command=407" urllib.urlopen(url) self.send_response(200) elif request_path == "player/playback/stepForward": url = "http://localhost/web/remotecontrol?command=10" urllib.urlopen(url) self.send_response(200) elif request_path == "player/playback/stepBack": url = "http://localhost/web/remotecontrol?command=8" urllib.urlopen(url) self.send_response(200) elif request_path == "player/playback/skipPrevious": url = "http://localhost/web/remotecontrol?command=412" urllib.urlopen(url) self.send_response(200) elif request_path == "player/playback/playMedia": url = "http://localhost/web/powerstate?newstate=4" urllib.urlopen(url) params = self.getParams() address = params["address"][0] port = params["port"][0] completeAddress = address + ":" + port protocol = params["protocol"][0] key = params["key"][0] if "offset" in params: offset = int(params["offset"][0]) else: offset = 0 machineIdentifier = params["machineIdentifier"][0] printl("target machineIdentifier: " + str(machineIdentifier), self, "D") for serverConfig in config.plugins.dreamplex.Entries: printl( "current machineIdentifier: " + str(serverConfig.machineIdentifier.value), self, "D") if machineIdentifier in serverConfig.machineIdentifier.value: printl("we have a match ...", self, "D") self.g_serverConfig = serverConfig self.plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.g_serverConfig, completeAddress, machineIdentifier)) listViewList, mediaContainer = self.plexInstance.getMoviesFromSection( protocol + "://" + address + ":" + port + key) autoPlayMode = False if offset > 0: forceResume = True else: forceResume = False resumeMode = False # this is always false because the ios and android app ask itself if we want to resume :-) no need to ask second time playbackMode = self.g_serverConfig.playbackType.value currentIndex = 0 libraryName = "Mixed" data = { "listViewList": listViewList, "mediaContainer": mediaContainer, "autoPlayMode": autoPlayMode, "forceResume": forceResume, "resumeMode": resumeMode, "playbackMode": playbackMode, "currentIndex": currentIndex, "libraryName": libraryName } self.playerCallback(data) xml = "<MediaContainer location='navigation' commandID='10'><Timeline state='stopped' time='0' type='music' /><Timeline state='stopped' time='0' type='video' /><Timeline state='stopped' time='0' type='photo' /></MediaContainer>" self.setXmlHeader(xml) self.end_headers() self.wfile.write(xml) else: printl("no match ...", self, "D") else: self.send_response(200) except: traceback.print_exc() self.wfile.close() printl("", self, "C") return try: self.wfile.close() except: pass printl("", self, "C")
def okbuttonClick(self, selectionOverride=None): printl("", self, "S") # this is used to step in directly into a server when there is only one entry in the serverlist if selectionOverride is not None: selection = selectionOverride else: selection = self["menu"].getCurrent() printl("selection = " + str(selection), self, "D") self.nextExitIsQuit = False if selection is not None: self.selectedEntry = selection[1] printl("selected entry " + str(self.selectedEntry), self, "D") if type(self.selectedEntry) is int: printl("selected entry is int", self, "D") if self.selectedEntry == Plugin.MENU_MAIN: printl("found Plugin.MENU_MAIN", self, "D") self["menu"].setList(self.menu_main_list) elif self.selectedEntry == Plugin.MENU_SERVER: printl("found Plugin.MENU_SERVER", self, "D") self.g_serverConfig = selection[3] # now that we know the server we establish global plexInstance self.plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.g_serverConfig)) self.checkServerState() elif self.selectedEntry == Plugin.MENU_MOVIES: printl("found Plugin.MENU_MOVIES", self, "D") self.getServerData("movies") elif self.selectedEntry == Plugin.MENU_TVSHOWS: printl("found Plugin.MENU_TVSHOWS", self, "D") self.getServerData("tvshow") elif self.selectedEntry == Plugin.MENU_MUSIC: printl("found Plugin.MENU_MUSIC", self, "D") self.getServerData("music") elif self.selectedEntry == Plugin.MENU_FILTER: printl("found Plugin.MENU_FILTER", self, "D") params = selection[3] printl("params: " + str(params), self, "D") self.s_url = params.get('t_url', "notSet") self.s_mode = params.get('t_mode', "notSet") self.s_final = params.get('t_final', "notSet") self.s_source = params.get('t_source', "notSet") self.s_uuid = params.get('t_uuid', "notSet") self.getFilterData() elif self.selectedEntry == Plugin.MENU_SYSTEM: printl("found Plugin.MENU_SYSTEM", self, "D") self["menu"].setList(self.getSettingsMenu()) self.refreshMenu(0) elif type(self.selectedEntry) is str: printl("selected entry is string", self, "D") if selection[1] == "DPS_Settings": self.session.open(DPS_Settings) elif selection[1] == "DPS_ServerEntriesListConfigScreen": self.session.open(DPS_ServerEntriesListConfigScreen) elif selection[1] == "DPS_SystemCheck": self.session.open(DPS_SystemCheck) elif selection[1] == "DPS_About": self.session.open(DPS_About) elif selection[1] == "DPS_Help": self.session.open(DPS_Help) elif selection[1] == "DPS_Exit": self.exit() elif selection[1] == "getMusicSections": self.getMusicSections(selection) else: printl("selected entry is executable", self, "D") params = selection[3] printl("params: " + str(params), self, "D") self.s_url = params.get('t_url', "notSet") self.showEpisodesDirectly = params.get( 't_showEpisodesDirectly', "notSet") self.uuid = params.get('t_uuid', "notSet") self.source = params.get('t_source', "notSet") self.viewGroup = params.get('t_viewGroup', "notSet") isSearchFilter = params.get('isSearchFilter', "notSet") printl("isSearchFilter: " + str(isSearchFilter), self, "D") if isSearchFilter == "True" or isSearchFilter and isSearchFilter != "notSet": printl("i am here: " + str(isSearchFilter), self, "D") self.session.openWithCallback( self.addSearchString, InputBox, title=_("Please enter your search string!"), text="", maxSize=55, type=Input.TEXT) else: self.executeSelectedEntry() printl("", self, "C")
def answer_request(self): printl("", self, "S") try: self.send_response(200) request_path=self.path[1:] request_path=re.sub(r"\?.*","",request_path) printl("request path is: [%s]" % request_path, self, "D") # first we get all params form url params = self.getParams() subMgr.updateCommandID(self.headers.get('X-Plex-Client-Identifier', self.client_address[0]), params.get('commandID', False)) if request_path == "player/timeline/subscribe": self.response(getOKMsg(), getPlexHeaders()) protocol = params.get('protocol', False) host = self.client_address[0] port = params.get('port', False) uuid = self.headers.get('X-Plex-Client-Identifier', "") commandID = params.get('commandID', 0) print "host: " + str(host) print "protocol: " + str(protocol) print "port: " + str(port) print "uuid: " + str(uuid) print "commandID: " + str(commandID) subMgr.addSubscriber(protocol, host, port, uuid, commandID) elif "player/timeline/unsubscribe" in request_path: self.response(getOKMsg(), getPlexHeaders()) uuid = self.headers.get('X-Plex-Client-Identifier', False) or self.client_address[0] subMgr.removeSubscriber(uuid) elif request_path == "resources": responseContent = getXMLHeader() responseContent += str(self.getResourceXml()) self.response(responseContent, getPlexHeaders()) elif request_path == "player/timeline/poll": if params.get('wait', False) == '1': sleep(950) commandID = params.get('commandID', 0) self.response(re.sub(r"INSERTCOMMANDID", str(commandID), subMgr.msg(getPlayers())), { 'Access-Control-Expose-Headers': 'X-Plex-Client-Identifier', 'Content-Type': 'text/xml' }) elif request_path == "playerProgress": # subMgr.lastkey = self.currentKey # subMgr.server = self.currentServer # subMgr.port = self.currentPort # subMgr.protocol = self.currentProtocol subMgr.progressFromEnigma2 = params['progress'] subMgr.playerStateFromEnigma2 = params["state"] subMgr.durationFromEnigma2 = params["duration"] subMgr.lastkey = params["lastKey"] subMgr.notify() elif request_path == "player/playback/seekTo": offset = params["offset"] elif request_path == "player/playback/setParameters": volume = params["volume"] if self.webifInstalled: self.response(getOKMsg(), getPlexHeaders()) url = "http://localhost/web/vol?set=set" + str(volume) urllib.urlopen(url) elif request_path == "/player/playback/pause": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/remotecontrol?command=400" urllib.urlopen(url) elif request_path == "player/playback/stop": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/remotecontrol?command=377" urllib.urlopen(url) elif request_path == "player/playback/skipNext": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/remotecontrol?command=407" urllib.urlopen(url) elif request_path == "player/playback/stepForward": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/remotecontrol?command=10" urllib.urlopen(url) elif request_path == "player/playback/stepBack": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/remotecontrol?command=8" urllib.urlopen(url) elif request_path == "player/playback/skipPrevious": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/remotecontrol?command=412" urllib.urlopen(url) elif request_path == "player/playback/playMedia": self.response(getOKMsg(), getPlexHeaders()) if self.webifInstalled: url = "http://localhost/web/powerstate?newstate=4" urllib.urlopen(url) self.currentAddress = params.get('address', self.client_address[0]) self.currentKey = params['key'] self.currentPort = params['port'] self.currentProtocol = params.get('protocol', "http") self.currentCompleteAddress = self.currentAddress + ":" + self.currentPort if "offset" in params: offset = int(params["offset"]) else: offset = 0 machineIdentifier = params["machineIdentifier"] printl("target machineIdentifier: " + str(machineIdentifier), self, "D") for serverConfig in config.plugins.dreamplex.Entries: printl("current machineIdentifier: " + str(serverConfig.machineIdentifier.value), self, "D") if machineIdentifier in serverConfig.machineIdentifier.value: printl("we have a match ...", self, "D") self.g_serverConfig = serverConfig self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.g_serverConfig, self.currentCompleteAddress, machineIdentifier)) listViewList, mediaContainer = self.plexInstance.getMoviesFromSection(self.currentProtocol + "://" + self.currentAddress + ":" + self.currentPort + self.currentKey) autoPlayMode = False if offset > 0: forceResume = True else: forceResume = False resumeMode = False # this is always false because the ios and android app ask itself if we want to resume :-) no need to ask second time playbackMode = self.g_serverConfig.playbackType.value currentIndex = 0 libraryName = "Mixed" data = {"listViewList": listViewList, "mediaContainer": mediaContainer, "autoPlayMode": autoPlayMode, "forceResume": forceResume, "resumeMode": resumeMode, "playbackMode": playbackMode, "currentIndex": currentIndex, "libraryName": libraryName} self.playerCallback(data) # subMgr.lastkey = self.currentKey # subMgr.server = self.currentAddress # subMgr.port = self.currentPort # subMgr.protocol = self.currentProtocol # subMgr.notify() else: printl("no match ...", self, "D") else: self.send_response(200) except: traceback.print_exc() self.wfile.close() printl("", self, "C") return try: self.wfile.close() except: pass printl("", self, "C")
def answer_request(self): printl("", self, "S") try: request_path = self.path[1:] request_path = re.sub(r"\?.*", "", request_path) printl("request path is: [%s]" % request_path, self, "D") # first we get all params form url params = self.getParams() data = { "command": "updateCommandId", "uuid": self.headers.get('X-Plex-Client-Identifier', self.client_address[0]), "commandID": params.get('commandID', False) } self.playerCallback(data) self.resetCallback() if request_path == "player/timeline/subscribe": self.response(getOKMsg(), getPlexHeaders()) protocol = params.get('protocol', False) host = self.client_address[0] port = params.get('port', False) uuid = self.headers.get('X-Plex-Client-Identifier', "") commandID = params.get('commandID', 0) printl("host: " + str(host), self, "D") printl("protocol: " + str(protocol), self, "D") printl("port: " + str(port), self, "D") printl("uuid: " + str(uuid), self, "D") printl("commandID: " + str(commandID), self, "D") data = { "command": "addSubscriber", "protocol": protocol, "host": host, "port": port, "uuid": uuid, "commandID": commandID } #subMgr.addSubscriber(protocol, host, port, uuid, commandID) self.playerCallback(data) self.resetCallback() elif "player/timeline/unsubscribe" in request_path: self.response(getOKMsg(), getPlexHeaders()) uuid = self.headers.get('X-Plex-Client-Identifier', False) or self.client_address[0] data = {"command": "removeSubscriber", "uuid": uuid} #subMgr.removeSubscriber(uuid) self.playerCallback(data) self.resetCallback() elif request_path == "resources": responseContent = getXMLHeader() responseContent += str(self.getResourceXml()) self.response(responseContent, getPlexHeaders()) elif request_path == "player/timeline/poll": commandID = params.get('commandID', 0) self.subMgr = SubscriptionManager() try: e2params = self.session.current_dialog.getPlayerState() if e2params: self.subMgr.progressFromEnigma2 = e2params['progress'] self.subMgr.playerStateFromEnigma2 = e2params["state"] self.subMgr.durationFromEnigma2 = e2params["duration"] self.subMgr.lastkey = e2params["lastKey"] self.answerPoll(commandID) sleep(1) except: print "no params" self.answerPoll(commandID) sleep(1) elif request_path == "player/playback/setParameters": volume = params["volume"] data = {"command": "setVolume", "volume": volume} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/pause": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "pause"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/play": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "play"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/stop": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "stop"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/skipNext": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "skipNext"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/skipPrevious": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "skipPrevious"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/stepForward": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "stepForward"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/stepBack": self.response(getOKMsg(), getPlexHeaders()) data = {"command": "stepBack"} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/seekTo": self.response(getOKMsg(), getPlexHeaders()) offset = params["offset"] data = {"command": "seekTo", "offset": offset} self.playerCallback(data) self.resetCallback() elif request_path == "player/playback/playMedia": self.response(getOKMsg(), getPlexHeaders()) self.currentAddress = params.get('address', self.client_address[0]) self.currentKey = params['key'] self.currentPort = params['port'] self.currentProtocol = params.get('protocol', "http") self.currentCompleteAddress = self.currentAddress + ":" + self.currentPort if "offset" in params: offset = int(params["offset"]) else: offset = 0 machineIdentifier = params["machineIdentifier"] printl("target machineIdentifier: " + str(machineIdentifier), self, "D") for serverConfig in config.plugins.dreamplex.Entries: printl( "current machineIdentifier: " + str(serverConfig.machineIdentifier.value), self, "D") if machineIdentifier in serverConfig.machineIdentifier.value: printl("we have a match ...", self, "D") self.g_serverConfig = serverConfig self.plexInstance = Singleton().getPlexInstance( PlexLibrary(self.session, self.g_serverConfig, self.currentCompleteAddress, machineIdentifier)) listViewList, mediaContainer = self.plexInstance.getMixedContentFromSection( self.currentProtocol + "://" + self.currentAddress + ":" + self.currentPort + self.currentKey, fromRemotePlayer=True) autoPlayMode = False if offset > 0: forceResume = True else: forceResume = False resumeMode = False # this is always false because the ios and android app ask itself if we want to resume :-) no need to ask second time playbackMode = self.g_serverConfig.playbackType.value currentIndex = 0 libraryName = "Mixed" splittedData = self.currentKey.split("/") subtitleData = self.plexInstance.getSelectedSubtitleDataById( self.currentCompleteAddress, splittedData[-1]) data = { "command": "playMedia", "currentKey": self.currentKey, "listViewList": listViewList, "mediaContainer": mediaContainer, "autoPlayMode": autoPlayMode, "forceResume": forceResume, "resumeMode": resumeMode, "playbackMode": playbackMode, "currentIndex": currentIndex, "libraryName": libraryName, "subtitleData": subtitleData } self.playerCallback(data) self.resetCallback() else: printl("no match ...", self, "D") else: self.response(getOKMsg(), getPlexHeaders()) except: traceback.print_exc() self.wfile.close() printl("", self, "C") return try: self.wfile.close() except: pass printl("", self, "C")