New options 'advanced priority tuner' by type tuners
authorDima73 <Dima-73@inbox.lv>
Fri, 18 Sep 2015 18:10:41 +0000 (21:10 +0300)
committerDima73 <Dima-73@inbox.lv>
Fri, 18 Sep 2015 18:10:41 +0000 (21:10 +0300)
Navigation.py
RecordTimer.py
data/setup.xml
lib/python/Components/UsageConfig.py

index fcde907..4da0190 100644 (file)
@@ -1,5 +1,6 @@
-from enigma import eServiceCenter, eServiceReference, eTimer, pNavigation, getBestPlayableServiceReference, iPlayableService, eActionMap
+from enigma import eServiceCenter, eServiceReference, eTimer, pNavigation, getBestPlayableServiceReference, iPlayableService, eActionMap, setPreferredTuner
 from Components.ParentalControl import parentalControl
+from Components.SystemInfo import SystemInfo
 from Components.config import config, configfile
 from Tools.BoundFunction import boundFunction
 from Tools.StbHardware import setFPWakeuptime, getFPWakeuptime, getFPWasTimerWakeup
@@ -96,10 +97,31 @@ class Navigation:
                                self.currentlyPlayingServiceOrGroup = ref
                                if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
                                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
+                               dvb_service = '%3a//' not in playref.toString() and not playref.toString().rsplit(":", 1)[1].startswith("/")
+                               setPriorityFrontend = False
+                               if dvb_service:
+                                       type_service = playref.getUnsignedData(4) >> 16
+                                       if type_service == 0xEEEE:
+                                               if SystemInfo["DVB-T_priority_tuner_available"] and config.usage.frontend_priority_dvbt.value != "-2":
+                                                       if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
+                                                               setPreferredTuner(int(config.usage.frontend_priority_dvbt.value))
+                                                               setPriorityFrontend = True
+                                       elif type_service == 0xFFFF:
+                                               if SystemInfo["DVB-C_priority_tuner_available"] and config.usage.frontend_priority_dvbc.value != "-2":
+                                                       if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
+                                                               setPreferredTuner(int(config.usage.frontend_priority_dvbc))
+                                                               setPriorityFrontend = True
+                                       else:
+                                               if SystemInfo["DVB-S_priority_tuner_available"] and config.usage.frontend_priority_dvbs.value != "-2":
+                                                       if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
+                                                               setPreferredTuner(int(config.usage.frontend_priority_dvbs.value))
+                                                               setPriorityFrontend = True
                                if self.pnav.playService(playref):
                                        print "Failed to start", playref
                                        self.currentlyPlayingServiceReference = None
                                        self.currentlyPlayingServiceOrGroup = None
+                               if setPriorityFrontend:
+                                       setPreferredTuner(int(config.usage.frontend_priority.value))
                                return 0
                elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
index 6f8aa1d..423aab5 100644 (file)
@@ -4,6 +4,7 @@ from enigma import eEPGCache, getBestPlayableServiceReference, \
 
 from Components.config import config
 from Components.UsageConfig import defaultMoviePath
+from Components.SystemInfo import SystemInfo
 from Components.TimerSanityCheck import TimerSanityCheck
 
 from Screens.MessageBox import MessageBox
@@ -169,7 +170,24 @@ class RecordTimerEntry(timer.TimerEntry, object):
                self.descramble = descramble
                self.record_ecm = record_ecm
                self.rename_repeat = rename_repeat
-               self.needChangePriorityFrontend = config.usage.recording_frontend_priority.value != "-2" and config.usage.recording_frontend_priority.value != config.usage.frontend_priority.value
+               self.setAdvancedPriorityFrontend = None
+               rec_ref = self.service_ref and self.service_ref.ref
+               dvb_service = rec_ref and '%3a//' not in rec_ref.toString() and not rec_ref.toString().rsplit(":", 1)[1].startswith("/")
+               if dvb_service:
+                       type_service = rec_ref.getUnsignedData(4) >> 16
+                       if type_service == 0xEEEE:
+                               if SystemInfo["DVB-T_priority_tuner_available"] and config.usage.recording_frontend_priority_dvbt.value != "-2":
+                                       if config.usage.recording_frontend_priority_dvbt.value != config.usage.frontend_priority.value:
+                                               self.setAdvancedPriorityFrontend = config.usage.recording_frontend_priority_dvbt.value
+                       elif type_service == 0xFFFF:
+                               if SystemInfo["DVB-C_priority_tuner_available"] and config.usage.recording_frontend_priority_dvbc.value != "-2":
+                                       if config.usage.recording_frontend_priority_dvbc.value != config.usage.frontend_priority.value:
+                                               self.setAdvancedPriorityFrontend = config.usage.recording_frontend_priority_dvbc.value
+                       else:
+                               if SystemInfo["DVB-S_priority_tuner_available"] and config.usage.recording_frontend_priority_dvbs.value != "-2":
+                                       if config.usage.recording_frontend_priority_dvbs.value != config.usage.frontend_priority.value:
+                                               self.setAdvancedPriorityFrontend = config.usage.recording_frontend_priority_dvbs.value
+               self.needChangePriorityFrontend = self.setAdvancedPriorityFrontend is not None or config.usage.recording_frontend_priority.value != "-2" and config.usage.recording_frontend_priority.value != config.usage.frontend_priority.value
                self.change_frontend = False
                self.InfoBarInstance = Screens.InfoBar.InfoBar.instance
                self.ts_dialog = None
@@ -461,11 +479,12 @@ class RecordTimerEntry(timer.TimerEntry, object):
                if self.needChangePriorityFrontend:
                        elem = None
                        if not self.change_frontend and not setdefault:
-                               elem = config.usage.recording_frontend_priority.value
+                               elem = (self.setAdvancedPriorityFrontend is not None and self.setAdvancedPriorityFrontend) or 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
+                               self.setAdvancedPriorityFrontend = None
                        if elem is not None:
                                setPreferredTuner(int(elem))
 
index cdaf35e..77aa439 100644 (file)
                <item level="2" text="Enable fallback remote receiver" description="Enable remote enigma2 receiver to be tried to tune into services that cannot be tuned into locally (e.g. tuner is occupied or service type is unavailable on the local tuner. Specify complete URL including http:// and port number (normally ...:8001), e.g. http://second_box:8001.">config.usage.remote_fallback_enabled</item>
                <item level="2" text="Fallback remote receiver URL" description="URL of fallback remote receiver">config.usage.remote_fallback</item>
                <item level="2" text="Preferred tuner" description="Configure which tuner will be preferred, when more than one tuner is available. If set to 'auto' the system will give priority to the tuner having the lowest number of channels/satellites.">config.usage.frontend_priority</item>
+               <item level="2" text="Preferred tuner DVB-S" description="When enabled, this setting has more weight than 'Preferred tuner'." requires="DVB-S_priority_tuner_available">config.usage.frontend_priority_dvbs</item>
+               <item level="2" text="Preferred tuner DVB-T" description="When enabled, this setting has more weight than 'Preferred tuner'." requires="DVB-T_priority_tuner_available">config.usage.frontend_priority_dvbt</item>
+               <item level="2" text="Preferred tuner DVB-C" description="When enabled, this setting has more weight than 'Preferred tuner'." requires="DVB-C_priority_tuner_available">config.usage.frontend_priority_dvbc</item>
                <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="2" text="Preferred tuner DVB-S for recordings" description="When enabled, this setting has more weight than 'Preferred tuner for recordings'." requires="DVB-S_priority_tuner_available">config.usage.recording_frontend_priority_dvbs</item>
+               <item level="2" text="Preferred tuner DVB-T for recordings" description="When enabled, this setting has more weight than 'Preferred tuner for recordings'." requires="DVB-T_priority_tuner_available">config.usage.recording_frontend_priority_dvbt</item>
+               <item level="2" text="Preferred tuner DVB-C for recordings" description="When enabled, this setting has more weight than 'Preferred tuner for recordings'." requires="DVB-C_priority_tuner_available">config.usage.recording_frontend_priority_dvbc</item>
                <item level="2" text="Disable background scanning" description="When enabled, the receiver will no longer monitor the tuned transponder for possible changes. Do not use this option unless you know what you are doing.">config.misc.disable_background_scan</item>
                <item level="2" text="Include EIT in http streams" description="When enabled, EIT data will be included in http streams. This allows a client receiver to show EPG.">config.streaming.stream_eit</item>
                <item level="2" text="Include AIT in http streams" description="When enabled, AIT data will be included in http streams. This allows a client receiver to use HbbTV.">config.streaming.stream_ait</item>
index 5738de7..6324315 100644 (file)
@@ -188,14 +188,44 @@ def InitUsageConfig():
        config.usage.remote_fallback_enabled = ConfigYesNo(default = False);
        config.usage.remote_fallback = ConfigText(default = "", fixed_size = False);
 
+       dvbs_nims = [("-2", _("Disabled"))]
+       dvbt_nims = [("-2", _("Disabled"))]
+       dvbc_nims = [("-2", _("Disabled"))]
        nims = [("-1", _("auto"))]
        for x in nimmanager.nim_slots:
+               if x.isCompatible("DVB-S"):
+                       dvbs_nims.append((str(x.slot), x.getSlotName()))
+               elif x.isCompatible("DVB-T"):
+                       dvbt_nims.append((str(x.slot), x.getSlotName()))
+               elif x.isCompatible("DVB-C"):
+                       dvbc_nims.append((str(x.slot), x.getSlotName()))
                nims.append((str(x.slot), x.getSlotName()))
        config.usage.frontend_priority = ConfigSelection(default = "-1", choices = list(nims))
        nims.insert(0,("-2", _("Disabled")))
        config.usage.recording_frontend_priority = ConfigSelection(default = "-2", choices = nims)
-       config.misc.disable_background_scan = ConfigYesNo(default = False)
+       config.usage.frontend_priority_dvbs = ConfigSelection(default = "-2", choices = list(dvbs_nims))
+       dvbs_nims.insert(1,("-1", _("auto")))
+       config.usage.recording_frontend_priority_dvbs = ConfigSelection(default = "-2", choices = dvbs_nims)
+       config.usage.frontend_priority_dvbt = ConfigSelection(default = "-2", choices = list(dvbt_nims))
+       dvbt_nims.insert(1,("-1", _("auto")))
+       config.usage.recording_frontend_priority_dvbt = ConfigSelection(default = "-2", choices = dvbt_nims)
+       config.usage.frontend_priority_dvbc = ConfigSelection(default = "-2", choices = list(dvbc_nims))
+       dvbc_nims.insert(1,("-1", _("auto")))
+       config.usage.recording_frontend_priority_dvbc = ConfigSelection(default = "-2", choices = dvbc_nims)
+       if len(dvbs_nims) > 2 and (len(dvbt_nims) > 1 or len(dvbc_nims) > 1):
+               SystemInfo["DVB-S_priority_tuner_available"] = True
+       else:
+               SystemInfo["DVB-S_priority_tuner_available"] = False
+       if len(dvbt_nims) > 2 and (len(dvbs_nims) > 1 or len(dvbc_nims) > 1):
+               SystemInfo["DVB-T_priority_tuner_available"] = True
+       else:
+               SystemInfo["DVB-T_priority_tuner_available"] = False
+       if len(dvbc_nims) > 2 and (len(dvbs_nims) > 1 or len(dvbt_nims) > 1):
+               SystemInfo["DVB-C_priority_tuner_available"] = True
+       else:
+               SystemInfo["DVB-C_priority_tuner_available"] = False
 
+       config.misc.disable_background_scan = ConfigYesNo(default = False)
        config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [
                ('barleft', _("Progress bar left")),
                ('barright', _("Progress bar right")),