File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 22
22
checkmktmp ()
23
23
writePidFile ()
24
24
25
- if cc .ip == '127.0.0.1' or None : # We verify the local IP.
25
+ if cc .ip == '127.0.0.1' : # We verify the local IP.
26
26
print (colors .error ('Your computer is not connected to any network' ))
27
27
terminate ()
28
28
Original file line number Diff line number Diff line change @@ -36,13 +36,21 @@ def __init__(self): ## __init__ to call the self.ip
36
36
37
37
if self .platform == 'Linux' :
38
38
self .netifaces_ip ()
39
+ try :
40
+ self .ip = self .discovered_ip
41
+ except AttributeError :
42
+ self .ip = '127.0.0.1'
39
43
else :
40
44
try :
41
45
self .ip = socket .gethostbyname (socket .gethostname ())
42
46
if self .debug == True :
43
47
print (':::cast::: sockets method' , self .ip )
44
48
except socket .gaierror :
45
49
self .netifaces_ip ()
50
+ try :
51
+ self .ip = self .discovered_ip
52
+ except AttributeError :
53
+ self .ip = '127.0.0.1'
46
54
47
55
def netifaces_ip (self ):
48
56
import netifaces
@@ -53,9 +61,9 @@ def netifaces_ip(self):
53
61
iface = netifaces .ifaddresses (interface ).get (netifaces .AF_INET )
54
62
if iface != None and iface [0 ]['addr' ] != '127.0.0.1' :
55
63
for e in iface :
56
- self .ip = str (e ['addr' ])
64
+ self .discovered_ip = str (e ['addr' ])
57
65
if self .debug == True :
58
- print (':::cast::: netifaces method' , self .ip )
66
+ print (':::cast::: netifaces method' , self .discovered_ip )
59
67
60
68
def initialize_cast (self ):
61
69
import mkchromecast .__init__ # This is to verify against some needed variables
You can’t perform that action at this time.
0 commit comments