summarylogtreecommitdiffstats
path: root/arch.patch
blob: a85e7834b6163246f89611c333e125cc381ac7cb (plain)
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
--- src/pyarchey-0.7/pyarchey/pyarchey.py	2016-07-03 21:06:51.984648092 +0200
+++ src/pyarchey-0.7/pyarchey/pyarchey.py	2016-07-03 21:12:46.701437069 +0200
@@ -563,9 +563,11 @@
 
 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)
 
@@ -574,11 +576,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
@@ -601,7 +603,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()')