'advanced priority tuner' update
authorDima73 <Dima-73@inbox.lv>
Sat, 19 Sep 2015 17:39:37 +0000 (20:39 +0300)
committerErik Slagter <erik@openpli.org>
Sun, 20 Sep 2015 07:27:46 +0000 (09:27 +0200)
-add missing  *.dvbc.value
-code optimization
thank Taapat

Signed-off-by: Erik Slagter <erik@openpli.org>

Navigation.py
RecordTimer.py
lib/python/Components/UsageConfig.py

index ca02fb0..90be794 100644 (file)
@@ -98,24 +98,25 @@ class Navigation:
                                if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
                                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                                setPriorityFrontend = False
-                               str_service = playref.toString()
-                               if '%3a//' not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
-                                       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 SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo["DVB-C_priority_tuner_available"] or SystemInfo["DVB-S_priority_tuner_available"]:
+                                       str_service = playref.toString()
+                                       if '%3a//' not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
+                                               type_service = playref.getUnsignedData(4) >> 16
+                                               if type_service == 0xEEEE:
+                                                       if 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 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.value))
+                                                                       setPriorityFrontend = True
+                                               else:
+                                                       if 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
index f54bec3..3d4e1af 100644 (file)
@@ -171,22 +171,23 @@ class RecordTimerEntry(timer.TimerEntry, object):
                self.record_ecm = record_ecm
                self.rename_repeat = rename_repeat
                self.setAdvancedPriorityFrontend = None
-               rec_ref = self.service_ref and self.service_ref.ref
-               str_service = rec_ref and rec_ref.toString()
-               if str_service and '%3a//' not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
-                       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
+               if SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo["DVB-C_priority_tuner_available"] or SystemInfo["DVB-S_priority_tuner_available"]:
+                       rec_ref = self.service_ref and self.service_ref.ref
+                       str_service = rec_ref and rec_ref.toString()
+                       if str_service and '%3a//' not in str_service and not str_service.rsplit(":", 1)[1].startswith("/"):
+                               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
index 743b4ac..6c5dac4 100644 (file)
@@ -212,18 +212,9 @@ def InitUsageConfig():
        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) > 3 and (len(dvbt_nims) > 2 or len(dvbc_nims) > 2):
-               SystemInfo["DVB-S_priority_tuner_available"] = True
-       else:
-               SystemInfo["DVB-S_priority_tuner_available"] = False
-       if len(dvbt_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbc_nims) > 2):
-               SystemInfo["DVB-T_priority_tuner_available"] = True
-       else:
-               SystemInfo["DVB-T_priority_tuner_available"] = False
-       if len(dvbc_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbt_nims) > 2):
-               SystemInfo["DVB-C_priority_tuner_available"] = True
-       else:
-               SystemInfo["DVB-C_priority_tuner_available"] = False
+       SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and (len(dvbt_nims) > 2 or len(dvbc_nims) > 2)
+       SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbc_nims) > 2)
+       SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbt_nims) > 2)
 
        config.misc.disable_background_scan = ConfigYesNo(default = False)
        config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [