Standby: When a recording is playing resume this recording
authorlittlesat <littlesat99@yahoo.com>
Sun, 8 Feb 2015 11:48:04 +0000 (12:48 +0100)
committerlittlesat <littlesat99@yahoo.com>
Sun, 8 Feb 2015 11:48:04 +0000 (12:48 +0100)
lib/python/Screens/Standby.py

index febd85b..cbda871 100644 (file)
@@ -63,8 +63,13 @@ class Standby(Screen):
                self.paused_service = None
                self.prev_running_service = None
 
-               if self.session.current_dialog:
-                       if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
+               self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup()
+               service = self.prev_running_service and self.prev_running_service.toString()
+               if service:
+                       if service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/"):
+                               self.paused_service = self.session.current_dialog
+                               self.paused_service.pauseService()
+                       else:
                                self.timeHandler =  eDVBLocalTimeHandler.getInstance()
                                if self.timeHandler.ready():
                                        if self.session.nav.getCurrentlyPlayingServiceOrGroup():
@@ -74,9 +79,7 @@ class Standby(Screen):
                                        self.timeHandler = None
                                else:
                                        self.timeHandler.m_timeUpdated.get().append(self.stopService)
-                       elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
-                               self.paused_service = self.session.current_dialog
-                               self.paused_service.pauseService()
+
                if self.session.pipshown:
                        from Screens.InfoBar import InfoBar
                        InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()
@@ -100,12 +103,16 @@ class Standby(Screen):
                self.standbyTimeoutTimer.stop()
                self.standbyStopServiceTimer.stop()
                self.timeHandler and self.timeHandler.m_timeUpdated.get().remove(self.stopService)
-               if self.prev_running_service:
-                       self.session.nav.playService(self.prev_running_service)
-                       from Screens.InfoBar import InfoBar
-                       InfoBar.instance and InfoBar.instance.servicelist.correctChannelNumber()
-               elif self.paused_service:
+               if self.paused_service:
                        self.paused_service.unPauseService()
+               elif self.prev_running_service:
+                       service = self.prev_running_service.toString()
+                       if config.servicelist.startupservice_onstandby.value:
+                               self.session.nav.playService(eServiceReference(config.servicelist.startupservice.value))
+                               from Screens.InfoBar import InfoBar
+                               InfoBar.instance and InfoBar.instance.servicelist.correctChannelNumber()
+                       else:
+                               self.session.nav.playService(self.prev_running_service)
                self.session.screen["Standby"].boolean = False
                globalActionMap.setEnabled(True)
                if RecordTimer.RecordTimerEntry.receiveRecordEvents:
@@ -119,11 +126,6 @@ class Standby(Screen):
                        config.misc.standbyCounter.value += 1
 
        def stopService(self):
-               self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup()
-               if config.servicelist.startupservice_onstandby.value:
-                       service = self.prev_running_service.toString()
-                       if not(service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/")):
-                               self.prev_running_service = eServiceReference(config.servicelist.startupservice.value)
                self.session.nav.stopService()
 
        def createSummary(self):