diff --git a/src/DP_Player.py b/src/DP_Player.py index 3fc6a920..d637ada8 100755 --- a/src/DP_Player.py +++ b/src/DP_Player.py @@ -577,6 +577,23 @@ def startTimelineWatcher(self): printl("", self, "C") + #=========================================================================== + # + #=========================================================================== + def pauseService(self): + printl("", self, "S") + + if self.playbackType == "1" and self.universalTranscoder: + self.transcoderHeartbeat = eTimer() + self.transcoderHeartbeat.callback.append(self.keepTranscoderAlive) + self.transcoderHeartbeat.start(10000,False) + + self.timelineWatcher.stop() + + super(DP_Player,self).pauseService() + + printl("", self, "C") + #=========================================================================== # #=========================================================================== @@ -586,6 +603,10 @@ def unPauseService(self): self.hide() self.setSeekState(self.SEEK_STATE_PLAY) + self.transcoderHeartbeat.stop() + + self.timelineWatcher.start(5000,False) + printl("", self, "S") #=========================================================================== # @@ -994,6 +1015,16 @@ def handleProgress(self, EOF=False): printl("", self, "C") + #=========================================================================== + # + #=========================================================================== + def keepTranscoderAlive(self): + printl("", self, "S") + + self.plexInstance.doRequest("http://"+self.server+"/video/:/transcode/universal/ping?session=" + self.transcodingSession) + + printl("", self, "C") + #=========================================================================== # #=========================================================================== @@ -1062,21 +1093,25 @@ def updateTimeline(self): self["endingTime"].setText(strftime("%H:%M:%S", endingTime)) + print "0" if self.multiUserServer: + print "a" try: + print "1" printl("currentTime: " + str(currentTime), self, "C") printl("totalTime: " + str(totalTime), self, "C") urlPath = self.server + "/:/timeline?containerKey=/library/sections/onDeck&key=/library/metadata/" + self.id + "&ratingKey=" + self.id seekState = self.seekstate - print seekState - sleep(2) + if seekState == self.SEEK_STATE_PAUSE: + print "2" printl( "Movies PAUSED time: %s secs of %s @ %s%%" % ( currentTime, totalTime, progress), self,"D" ) urlPath += "&state=paused&time=" + str(currentTime*1000) + "&duration=" + str(totalTime*1000) elif seekState == self.SEEK_STATE_PLAY : + print "3" printl( "Movies PLAYING time: %s secs of %s @ %s%%" % ( currentTime, totalTime, progress),self,"D" ) urlPath += "&state=playing&time=" + str(currentTime*1000) + "&duration=" + str(totalTime*1000) @@ -1085,8 +1120,9 @@ def updateTimeline(self): # todo add stopped here if needed #urlPath += "&state=stopped&time=" + str(currentTime*1000) + "&duration=" + str(totalTime*1000) - + print "4" self.plexInstance.doRequest(urlPath) + print "5" except Exception, e: printl("exception: " + str(e), self, "E") diff --git a/src/DP_PlexLibrary.py b/src/DP_PlexLibrary.py index df1e66c2..6585f46e 100755 --- a/src/DP_PlexLibrary.py +++ b/src/DP_PlexLibrary.py @@ -2029,13 +2029,10 @@ def playLibraryMedia(self, myId, url): if not (self.g_transcode == "true" ): self.setAudioSubtitles(self.streams) - multiUserServer = False # multiuser works only if the server is compatible self.setServerDetails() - if self.g_serverVersion >= "0.9.8.0" and self.g_multiUser: - multiUserServer = True - printl("multiUserServer (version): " + str(multiUserServer),self,"I") + printl("multiUserServer (version): " + str(self.g_multiUser) + "(" + self.g_serverVersion + ")",self,"D") printl("PLAYURL => " + playurl, self, "I") printl("RESUME => " + str(resume), self, "I") @@ -2046,7 +2043,7 @@ def playLibraryMedia(self, myId, url): playerData["resumeStamp"] = resume playerData["server"] = self.server playerData["id"] = myId - playerData["multiUserServer"] = multiUserServer + playerData["multiUserServer"] = self.g_multiUser playerData["playbackType"] = self.serverConfig_playbackType playerData["connectionType"] = self.serverConfig_connectionType playerData["localAuth"] = self.serverConfig_localAuth