add DNS check, add checkforInterface
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 6 Jun 2008 14:47:12 +0000 (14:47 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 6 Jun 2008 14:47:12 +0000 (14:47 +0000)
lib/python/Components/Network.py

index 1c2b54e87591bca8d51d1a912ed76dd920ec28f4..06e81eaf21d8f6dc41947b4aa7956d768c3e48dc 100644 (file)
@@ -293,7 +293,7 @@ class Network:
                ret3=os.system("ping -c 1 www.google.de")
                if ret2 != 0:
                        ok_counter = ok_counter + 1             
                ret3=os.system("ping -c 1 www.google.de")
                if ret2 != 0:
                        ok_counter = ok_counter + 1             
-               if ok_counter == 0:
+               if ok_counter <= 2:
                        return True
                else:
                        return False
                        return True
                else:
                        return False
@@ -313,6 +313,29 @@ class Network:
                self.container.appClosed.get().remove(self.cmdFinished)
                self.container.dataAvail.get().remove(self.dataAvail)
 
                self.container.appClosed.get().remove(self.cmdFinished)
                self.container.dataAvail.get().remove(self.dataAvail)
 
+       def checkforInterface(self,iface):
+               ret=os.system("ifconfig " + iface + " up")
+               if ret == 0:
+                       return True
+               else:
+                       return False
+
+       def checkDNSLookup(self):
+               ok_counter = 0
+               ret1=os.system("nslookup www.dream-multimedia-tv.de")
+               if ret1 != 0:
+                       ok_counter = ok_counter + 1
+               ret2=os.system("nslookup www.heise.de")
+               if ret2 != 0:
+                       ok_counter = ok_counter + 1
+               ret3=os.system("nslookup www.google.de")
+               if ret2 != 0:
+                       ok_counter = ok_counter + 1             
+               if ok_counter <= 2:
+                       return True
+               else:
+                       return False
+               
 iNetwork = Network()
 
 def InitNetwork():
 iNetwork = Network()
 
 def InitNetwork():