def getReasons(session, retvalue=QUIT_SHUTDOWN): recordings = session.nav.getRecordings() jobs = len(job_manager.getPendingJobs()) reasons = [] next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): reasons.append( _("Recording(s) are in progress or coming up in few seconds!")) if jobs: if jobs == 1: job = job_manager.getPendingJobs()[0] reasons.append("%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100 * job.progress / float(job.end)))) else: reasons.append( (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs)) if eStreamServer.getInstance().getConnectedClients() or StreamServiceList: reasons.append(_("Client is streaming from this box!")) if not reasons and mediafilesInUse(session) and retvalue in ( QUIT_SHUTDOWN, QUIT_REBOOT, QUIT_UPGRADE_FP, QUIT_UPGRADE_PROGRAM, QUIT_UPGRADE_FPANEL): reasons.append(_("A file from media is in use!")) return "\n".join(reasons)
def standbyTimeout(self): if config.usage.standby_to_shutdown_timer_blocktime.value: curtime = localtime(time()) if curtime.tm_year > 1970: #check if the current time is valid curtime = (curtime.tm_hour, curtime.tm_min, curtime.tm_sec) begintime = tuple( config.usage.standby_to_shutdown_timer_blocktime_begin. value) endtime = tuple( config.usage.standby_to_shutdown_timer_blocktime_end.value) if begintime <= endtime and ( curtime >= begintime and curtime < endtime) or begintime > endtime and ( curtime >= begintime or curtime < endtime): duration = (endtime[0] * 3600 + endtime[1] * 60) - ( curtime[0] * 3600 + curtime[1] * 60 + curtime[2]) if duration: if duration < 0: duration += 24 * 3600 self.standbyTimeoutTimer.startLongTimer(duration) return if self.session.screen["TunerInfo"].tuner_use_mask or mediafilesInUse( self.session): self.standbyTimeoutTimer.startLongTimer(600) else: from RecordTimer import RecordTimerEntry RecordTimerEntry.TryQuitMainloop()
def standbyTimeout(self): if config.usage.standby_to_shutdown_timer_blocktime.value: curtime = localtime(time()) if curtime.tm_year > 1970: #check if the current time is valid curtime = (curtime.tm_hour, curtime.tm_min, curtime.tm_sec) begintime = tuple(config.usage.standby_to_shutdown_timer_blocktime_begin.value) endtime = tuple(config.usage.standby_to_shutdown_timer_blocktime_end.value) if begintime <= endtime and (curtime >= begintime and curtime < endtime) or begintime > endtime and (curtime >= begintime or curtime < endtime): duration = (endtime[0]*3600 + endtime[1]*60) - (curtime[0]*3600 + curtime[1]*60 + curtime[2]) if duration: if duration < 0: duration += 24*3600 self.standbyTimeoutTimer.startLongTimer(duration) return if self.session.screen["TunerInfo"].tuner_use_mask or mediafilesInUse(self.session): self.standbyTimeoutTimer.startLongTimer(600) else: from RecordTimer import RecordTimerEntry RecordTimerEntry.TryQuitMainloop()
def getReasons(session, retvalue=1): recordings = session.nav.getRecordings() jobs = len(job_manager.getPendingJobs()) reasons = [] next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): reasons.append(_("Recording(s) are in progress or coming up in few seconds!")) if jobs: if jobs == 1: job = job_manager.getPendingJobs()[0] reasons.append("%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))) else: reasons.append((ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs)) if eStreamServer.getInstance().getConnectedClients() or StreamServiceList: reasons.append(_("Client is streaming from this box!")) if not reasons and mediafilesInUse(session) and retvalue in (1, 2, 4, 42): reasons.append(_("A file from media is in use!")) return "\n".join(reasons)