aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-12-12 14:48:50 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-12-12 14:48:50 +0000
commit408c5296eb54925f097cf7b80343a38ba13f4cbf (patch)
tree8cd33aaa2dd5516fe87e038ef62c67834f31313b /lib/python/Components
parentc2f28d655c5a33f04bc340504116496c93c47f2b (diff)
downloadenigma2-408c5296eb54925f097cf7b80343a38ba13f4cbf.tar.gz
enigma2-408c5296eb54925f097cf7b80343a38ba13f4cbf.zip
get current ip address from ifconfig
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Network.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index 861d29ef..6990f356 100644
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -120,12 +120,10 @@ class Network:
#self.writeNetworkConfig()
def getCurrentIP(self):
- ip = [0, 0, 0, 0]
- try:
- print gethostbyname(gethostname())
- ip = gethostbyname(gethostname()).split('.')
- except:
- print "[Network.py] Could not get current ip (not necessarily an error)"
+ ip = [0,0,0,0]
+ for x in os.popen("ifconfig eth0 | grep 'inet addr:'", "r").readline().split(' '):
+ if x.split(':')[0] == "addr":
+ ip = x.split(':')[1].split('.')
print "[Network.py] got ip " + str(ip)
return ip