# Check for there being any active Movie playback or IPTV channel
# or any streaming clients before going to Deep Standby.
# However, it is possible to put the box into Standby with the
# MoviePlayer still active (it will play if the box is taken out
# of Standby) - similarly for the IPTV player. This should not
# prevent a DeepStandby
# And check for existing or imminent recordings, etc..
# Also added () around the test and split them across lines
# to make it clearer what each test is.
#
from Components.Converter.ClientsStreaming import ClientsStreaming
if ((not Screens.Standby.inStandby and NavigationInstance.instance.getCurrentlyPlayingServiceReference() and
('0:0:0:0:0:0:0:0:0' in NavigationInstance.instance.getCurrentlyPlayingServiceReference().toString() or
'4097:' in NavigationInstance.instance.getCurrentlyPlayingServiceReference().toString()
) or
(int(ClientsStreaming("NUMBER").getText()) > 0)
) or
(NavigationInstance.instance.RecordTimer.isRecording() or
abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - time()) <= 900 or
abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - time()) <= 900) or
(self.autosleepinstandbyonly == 'yes' and not Screens.Standby.inStandby) or
(self.autosleepinstandbyonly == 'yes' and Screens.Standby.inStandby and internalHDDNotSleeping()
)
):
self.do_backoff()
# retry
return False