X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/13e3018673a588fe5225bc1c3fe893593a9eadb3..f12d2ae45356b4519383de70ad1be1bc755c4391:/lib/python/Screens/InfoBarGenerics.py diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 718c2d54..986e2a41 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -38,6 +38,8 @@ from time import time, localtime, strftime from os import stat as os_stat from bisect import insort +from RecordTimer import RecordTimerEntry, RecordTimer + # hack alert! from Menu import MainMenu, mdom @@ -346,14 +348,14 @@ class InfoBarMenu: def mainMenu(self): print "loading mainmenu XML..." - menu = mdom.childNodes[0] - assert menu.tagName == "menu", "root element in menu must be 'menu'!" + menu = mdom.getroot() + assert menu.tag == "menu", "root element in menu must be 'menu'!" self.session.infobar = self # so we can access the currently active infobar from screens opened from within the mainmenu # at the moment used from the SubserviceSelection - self.session.openWithCallback(self.mainMenuClosed, MainMenu, menu, menu.childNodes) + self.session.openWithCallback(self.mainMenuClosed, MainMenu, menu) def mainMenuClosed(self, *val): self.session.infobar = None @@ -402,7 +404,7 @@ class InfoBarEPG: self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { "showEventInfo": (self.openEventView, _("show EPG...")), - "showSingleServiceEPG": (self.openSingleServiceEPG, _("show single service EPG...")), + "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")), "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible, }) @@ -487,6 +489,23 @@ class InfoBarEPG: ref=self.session.nav.getCurrentlyPlayingServiceReference() self.session.open(EPGSelection, ref) + def showEventInfoPlugins(self): + list = [] + for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO): + list.append((p.name, boundFunction(self.runPlugin, p))) + if len(list): + list.append((_("show single service EPG..."), self.openSingleServiceEPG)) + self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list) + else: + self.openSingleServiceEPG() + + def runPlugin(self, plugin): + plugin(session = self.session, servicelist = self.servicelist) + + def EventInfoPluginChosen(self, answer): + if answer is not None: + answer[1]() + def openSimilarList(self, eventid, refstr): self.session.open(EPGSelection, refstr, None, eventid) @@ -1012,7 +1031,7 @@ class InfoBarTimeshiftState(InfoBarPVRState): InfoBarPVRState.__init__(self, screen=TimeshiftState) def _mayShow(self): - if self.execing and self.timeshift_enabled: + if self.execing and self.timeshift_enabled and self.seekstate != self.SEEK_STATE_PLAY: self.pvrStateDialog.show() class InfoBarShowMovies: @@ -1256,7 +1275,6 @@ class InfoBarExtensions: from Tools.BoundFunction import boundFunction # depends on InfoBarExtensions -from Components.PluginComponent import plugins class InfoBarPlugins: def __init__(self): @@ -1274,6 +1292,28 @@ class InfoBarPlugins: def runPlugin(self, plugin): plugin(session = self.session, servicelist = self.servicelist) +from Components.Task import job_manager +class InfoBarJobman: + def __init__(self): + self.addExtension(extension = self.getJobList, type = InfoBarExtensions.EXTENSION_LIST) + + def getJobList(self): + list = [] + for job in job_manager.getPendingJobs(): + list.append(((boundFunction(self.getJobName, job), boundFunction(self.showJobView, job), lambda: True), None)) + return list + + def getJobName(self, job): + return "%s: %s (%d%%)" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))) + + def showJobView(self, job): + from Screens.TaskView import JobView + job_manager.in_background = False + self.session.openWithCallback(self.JobViewCB, JobView, job) + + def JobViewCB(self, in_background): + job_manager.in_background = in_background + # depends on InfoBarExtensions class InfoBarSleepTimer: def __init__(self): @@ -1387,8 +1427,8 @@ class InfoBarInstantRecord: except: pass - begin = time() - end = time() + 3600 * 10 + begin = int(time()) + end = begin + 3600 # dummy name = "instant record" description = "" eventid = None @@ -1404,15 +1444,33 @@ class InfoBarInstantRecord: if limitEvent: self.session.open(MessageBox, _("No event info found, recording indefinitely."), MessageBox.TYPE_INFO) - # TODO: needed? if isinstance(serviceref, eServiceReference): serviceref = ServiceReference(serviceref) recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = config.movielist.last_videodir.value) recording.dontSave = True - - self.session.nav.RecordTimer.record(recording) - self.recording.append(recording) + + if event is None or limitEvent == False: + recording.autoincrease = True + if recording.setAutoincreaseEnd(): + self.session.nav.RecordTimer.record(recording) + self.recording.append(recording) + else: + simulTimerList = self.session.nav.RecordTimer.record(recording) + if simulTimerList is not None: # conflict with other recording + name = simulTimerList[1].name + name_date = name + strftime(" %c", localtime(simulTimerList[1].begin)) + print "[TIMER] conflicts with", name_date + recording.autoincrease = True # start with max available length, then increment + if recording.setAutoincreaseEnd(): + self.session.nav.RecordTimer.record(recording) + self.recording.append(recording) + self.session.open(MessageBox, _("Record time limited due to conflicting timer %s" % name_date), MessageBox.TYPE_INFO) + else: + self.session.open(MessageBox, _("Couldn't record due to conflicting timer %s" % name), MessageBox.TYPE_INFO) + recording.autoincrease = False + else: + self.recording.append(recording) def isInstantRecordRunning(self): print "self.recording:", self.recording @@ -1470,6 +1528,8 @@ class InfoBarInstantRecord: if ret[0]: localendtime = localtime(ret[1]) print "stopping recording at", strftime("%c", localendtime) + if self.recording[self.selectedEntry].end != ret[1]: + self.recording[self.selectedEntry].autoincrease = False self.recording[self.selectedEntry].end = ret[1] self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry]) @@ -1481,7 +1541,9 @@ class InfoBarInstantRecord: def inputCallback(self, value): if value is not None: print "stopping recording after", int(value), "minutes." - self.recording[self.selectedEntry].end = time() + 60 * int(value) + if int(value) != 0: + self.recording[self.selectedEntry].autoincrease = False + self.recording[self.selectedEntry].end = int(time()) + 60 * int(value) self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry]) def instantRecord(self): @@ -1731,10 +1793,11 @@ class InfoBarSubserviceSelection: class InfoBarAdditionalInfo: def __init__(self): - self["RecordingPossible"] = Boolean(fixed=harddiskmanager.HDDCount() > 0) - self["TimeshiftPossible"] = Boolean(fixed=(harddiskmanager.HDDCount() > 0 and config.misc.rcused.value == 1)) + self["RecordingPossible"] = Boolean(fixed=harddiskmanager.HDDCount() > 0 and config.misc.rcused.value == 1) + self["TimeshiftPossible"] = self["RecordingPossible"] self["ShowTimeshiftOnYellow"] = Boolean(fixed=(not config.misc.rcused.value == 0)) self["ShowAudioOnYellow"] = Boolean(fixed=config.misc.rcused.value == 0) + self["ShowRecordOnRed"] = Boolean(fixed=config.misc.rcused.value == 1) self["ExtensionsAvailable"] = Boolean(fixed=1) class InfoBarNotifications: