[blindscan] added blindscan commands.
authorkos <kos@dev3>
Wed, 3 Apr 2013 09:46:12 +0000 (18:46 +0900)
committerkos <kos@dev3>
Wed, 3 Apr 2013 09:46:12 +0000 (18:46 +0900)
lib/python/Plugins/SystemPlugins/Blindscan/plugin.py

index 3ab1368..b25d890 100644 (file)
@@ -18,6 +18,8 @@ from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, S
 
 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager, getDesktop
 
 
 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager, getDesktop
 
+_supportNimType   = { 'AVL1208':'', 'AVL6222':'6222_', 'AVL6211':'6211_'}
+
 class Blindscan(ConfigListScreen, Screen):
        skin =  """
                <screen position="center,center" size="560,390" title="Blindscan">
 class Blindscan(ConfigListScreen, Screen):
        skin =  """
                <screen position="center,center" size="560,390" title="Blindscan">
@@ -331,6 +333,35 @@ class Blindscan(ConfigListScreen, Screen):
                self.doRun(tmp_list, tmp_pol, tmp_band)
                
        def doRun(self, tmp_list, tmp_pol, tmp_band):
                self.doRun(tmp_list, tmp_pol, tmp_band)
                
        def doRun(self, tmp_list, tmp_pol, tmp_band):
+               def GetCommand(nimIdx):
+                       _nimSocket = {}
+                       fp = file('/proc/bus/nim_sockets')
+
+                       sNo, sName = -1, ""
+                       for line in fp:
+                               line = line.strip()
+                               if line.startswith('NIM Socket'):
+                                       sNo = line.split()[2][:-1]
+                               elif line.startswith('Name:'):
+                                       sName = line.split()[3][4:-1]
+                               if sNo >= 0 and sName != "":
+                                       _nimSocket[sNo] = sName
+                                       sNo   = -1
+                                       sName = ''
+                       fp.close()
+
+                       try:
+                               sName = _nimSocket[str(nimIdx)]
+                               sType = _supportNimType[sName]
+                               return "vuplus_%(TYPE)sblindscan"%{'TYPE':sType}, None
+                       except: pass
+                       return "vuplus_blindscan", None
+               self.binName,nimName =  GetCommand(self.scan_nims.value)
+               if self.binName is None:
+                       self.session.open(MessageBox, "Blindscan is not supported in " + nimName + " tuner.", MessageBox.TYPE_ERROR)
+                       print nimName + " is not support blindscan."
+                       return
+
                self.full_data = ""
                self.total_list=[]
                for x in tmp_list:
                self.full_data = ""
                self.total_list=[]
                for x in tmp_list:
@@ -408,8 +439,9 @@ class Blindscan(ConfigListScreen, Screen):
                if self.getNimSocket(self.feid) < 0:
                        print "can't find i2c number!!"
                        return
                if self.getNimSocket(self.feid) < 0:
                        print "can't find i2c number!!"
                        return
-
-               cmd = "vuplus_blindscan %d %d %d %d %d %d %d %d" % (self.blindscan_start_frequency.value/1000000, self.blindscan_stop_frequency.value/1000000, self.blindscan_start_symbol.value/1000000, self.blindscan_stop_symbol.value/1000000, tab_pol[pol], tab_hilow[band], self.feid, self.getNimSocket(self.feid))
+               try:
+                       cmd = "%s %d %d %d %d %d %d %d %d" % (self.binName, self.blindscan_start_frequency.value/1000000, self.blindscan_stop_frequency.value/1000000, self.blindscan_start_symbol.value/1000000, self.blindscan_stop_symbol.value/1000000, tab_pol[pol], tab_hilow[band], self.feid, self.getNimSocket(self.feid))
+               except: return
                print "prepared command : [%s]" % (cmd)
                self.blindscan_container = eConsoleAppContainer()
                self.blindscan_container.appClosed.append(self.blindscanContainerClose)
                print "prepared command : [%s]" % (cmd)
                self.blindscan_container = eConsoleAppContainer()
                self.blindscan_container.appClosed.append(self.blindscanContainerClose)