X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/e7a77b87eee22c35e93cbd42b329dc5165e29144..7c8c99715d23af5678bbc8ded629f06202648025:/lib/python/Components/Network.py diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index c38c44c6..99afb75d 100644 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -120,12 +120,14 @@ 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)" + ipstr = [0,0,0,0] + for x in os.popen("ifconfig eth0 | grep 'inet addr:'", "r").readline().split(' '): + if x.split(':')[0] == "addr": + ipstr = x.split(':')[1].split('.') + ip = [] + for x in ipstr: + ip.append(int(x)) + print "[Network.py] got ip " + str(ip) return ip iNetwork = Network()