In a plugin for rec infobar... Why not try to make the change in e2 itself?
Done.
--- a/RecordTimer.py +++ b/RecordTimer.py @@ -1,6 +1,6 @@ import os from enigma import eEPGCache, getBestPlayableServiceReference, \ - eServiceReference, iRecordableService, quitMainloop, eActionMap + eServiceReference, iRecordableService, quitMainloop, eActionMap, setPreferredTuner from Components.config import config from Components.UsageConfig import defaultMoviePath @@ -167,7 +167,8 @@ self.tags = tags or [] self.descramble = descramble self.record_ecm = record_ecm - + self.needChangePriorityFrontend = config.usage.recording_frontend_priority.value != "-2" and config.usage.recording_frontend_priority.value != config.usage.frontend_priority.value + self.change_frontend = False self.log_entries = [] self.resetState() @@ -227,11 +228,12 @@ if not rec_ref: self.log(1, "'get best playable service for group... record' failed") return False - + self.setRecordingPreferredTuner() self.record_service = rec_ref and NavigationInstance.instance.recordService(rec_ref) if not self.record_service: self.log(1, "'record service' failed") + self.setRecordingPreferredTuner(setdefault=True) return False if self.repeated: @@ -264,6 +266,7 @@ NavigationInstance.instance.stopRecordService(self.record_service) self.record_service = None + self.setRecordingPreferredTuner(setdefault=True) return False return True @@ -296,6 +299,7 @@ cur_zap_ref = NavigationInstance.instance.getCurrentlyPlayingServiceReference() if cur_zap_ref and not cur_zap_ref.getPath():# we do not zap away if it is no live service Notifications.AddNotification(MessageBox, _("In order to record a timer, the TV was switched to the recording service!\n"), type=MessageBox.TYPE_INFO, timeout=20) + self.setRecordingPreferredTuner() self.failureCB(True) self.log(5, "zap to recording service") @@ -325,6 +329,7 @@ cur_ref = NavigationInstance.instance.getCurrentlyPlayingServiceReference() if cur_ref and not cur_ref.getPath(): if Screens.Standby.inStandby: + self.setRecordingPreferredTuner() self.failureCB(True) elif not config.recording.asktozap.value: self.log(8, "asking user to zap away") @@ -332,6 +337,7 @@ else: # zap without asking self.log(9, "zap without asking") Notifications.AddNotification(MessageBox, _("In order to record a timer, the TV was switched to the recording service!\n"), type=MessageBox.TYPE_INFO, timeout=20) + self.setRecordingPreferredTuner() self.failureCB(True) elif cur_ref: self.log(8, "currently running service is not a live service.. so stop it makes no sense") @@ -369,7 +375,7 @@ else: Notifications.AddNotification(Screens.Standby.Standby, StandbyCounterIncrease=False) record_res = self.record_service.start() - + self.setRecordingPreferredTuner(setdefault=True) if record_res: self.log(13, "start record returned %d" % record_res) self.do_backoff() @@ -427,6 +433,18 @@ return False self.end = new_end return True + + def setRecordingPreferredTuner(self, setdefault=False): + if self.needChangePriorityFrontend: + elem = None + if not self.change_frontend and not setdefault: + elem = config.usage.recording_frontend_priority.value + self.change_frontend = True + elif self.change_frontend and setdefault: + elem = config.usage.frontend_priority.value + self.change_frontend = False + if elem is not None: + setPreferredTuner(int(elem)) def sendStandbyNotification(self, answer): RecordTimerEntry.keypress() --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -172,6 +172,8 @@ for x in nimmanager.nim_slots: nims.append((str(x.slot), x.getSlotName())) config.usage.frontend_priority = ConfigSelection(default = "-1", choices = nims) + nims.append(("-2", _("Disabled"))) + config.usage.recording_frontend_priority = ConfigSelection(default = "-2", choices = nims) config.misc.disable_background_scan = ConfigYesNo(default = False) config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [ --- a/data/setup.xml +++ b/data/setup.xml @@ -103,6 +103,7 @@ <item level="1" text="EPG language selection 2" description="Configure the secondary EPG language.">config.autolanguage.audio_epglanguage_alternative</item> </setup> <setup key="recording" title="Record"> + <item level="2" text="Preferred tuner for recordings" description="Configure which tuner for recordings will be preferred, when more than one tuner is available.">config.usage.recording_frontend_priority</item> <item level="1" text="Recordings always have priority" description="When enabled, a recording is allowed to interrupt live tv, when there are no free tuners.">config.recording.asktozap</item> <item level="0" text="Margin before recording (minutes)" description="When nonzero, a recording will start earlier than the starting time indicated by the EPG.">config.recording.margin_before</item> <item level="0" text="Margin after recording (minutes)" description="When nonzero, a recording will stop later than the ending time indicated by the EPG.">config.recording.margin_after</item>