1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
--- src/pyarchey-0.6.8/pyarchey/pyarchey.py 2015-09-26 17:16:41.076808842 +0200
+++ src/pyarchey-0.6.8/pyarchey/pyarchey.py 2015-09-26 17:21:38.420151890 +0200
@@ -444,7 +444,7 @@
Does the printing. Either picture and info to screen or dumps json.
"""
if js:
- print json.dumps(self.json)
+ print(json.dumps(self.json))
else:
print(logosDict[self.distro].format(color = colorDict[self.distro], results = self.results))
@@ -555,9 +555,13 @@
class Disk(object):
def __init__(self,json=False):
- p = ps.disk_usage('/')
- total = p.total
- used = p.used
+ #p = ps.disk_usage('/')
+ #total = p.total
+ #used = p.used
+ total = sum([ps.disk_usage(part.mountpoint).total for part in ps.disk_partitions()])
+ used = sum([ps.disk_usage(part.mountpoint).used for part in ps.disk_partitions()])
+
+
used,total,size = autoSize(used,total)
@@ -566,11 +570,11 @@
if json:
disk = '%s / %s %s' % (used, total, size)
else:
- if usedpercent <= 33:
+ if usedpercent <= 50:
disk = '%s%s %s/ %s %s' % (colorDict['Sensors'][1], used, colorDict['Clear'][0], total, size)
- if usedpercent > 33 and usedpercent < 67:
+ if usedpercent > 50 and usedpercent < 75:
disk = '%s%s %s/ %s %s' % (colorDict['Sensors'][2], used, colorDict['Clear'][0], total, size)
- if usedpercent >= 67:
+ if usedpercent >= 75:
disk = '%s%s %s/ %s %s' % (colorDict['Sensors'][0], used, colorDict['Clear'][0], total, size)
self.key = 'Disk'
self.value = disk
@@ -592,7 +596,8 @@
if host.find('.local') < 0:
host=host + '.local'
- ip = socket.gethostbyname(host)
+ #ip = socket.gethostbyname(host)
+ ip = [(s.connect(('8.8.8.8', 80)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]
except:
print('Error in IP()')
|