-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (45 loc) · 1.5 KB
/
main.py
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
54
import shutil
import colorama
from colorama import Fore
# Config
# Auto reset color
colorama.init(autoreset=True)
# / = Linux File system, C:\\ = Windows File system
hdd = shutil.disk_usage('/')
# Variable
tz= hdd.total // (2**30)
tza=tz//60
uz=hdd.used//(2**30)
uza=uz//60
fz=hdd.free//(2**30)
fza=fz//60
minspace=tz/5
medspace=tz/2
# Total space and HDD rating
"""
Green: good than 800 Gigabytes
Yellow: medium than 400 Gigabytes
Red: bad than 400 Gigabytes
"""
if tz > 800:
print(f'Total: {Fore.LIGHTGREEN_EX}{tz}{Fore.RESET} Gigabyte ({Fore.LIGHTGREEN_EX}Good{Fore.RESET})')
elif tz > 400:
print(f'Total: {Fore.YELLOW}{tz}{Fore.RESET} Gigabyte ({Fore.YELLOW}On average{Fore.RESET})')
elif tz < 400 or tz==400:
print(f'Total: {Fore.RED}{tz}{Fore.RESET} Gigabyte {Fore.RED}(Bad){Fore.RESET}')
# Free space and used space
if minspace > fz:
print(f'Used: {Fore.RED}{uz}{Fore.RESET} Gigabyte')
print(f'Free: {Fore.RED}{fz}{Fore.RESET} Gigabyte')
elif minspace == fz:
print(f'Used: {Fore.RED}{uz}{Fore.RESET} Gigabyte')
print(f'Free: {Fore.RED}{fz}{Fore.RESET} Gigabyte')
elif medspace > fz:
print(f'Used: {Fore.YELLOW}{uz}{Fore.RESET} Gigabyte')
print(f'Free: {Fore.YELLOW}{fz}{Fore.RESET} Gigabyte')
elif medspace == fz:
print(f'Used: {Fore.YELLOW}{uz}{Fore.RESET} Gigabyte')
print(f'Free: {Fore.YELLOW}{fz}{Fore.RESET} Gigabyte')
elif fz > medspace:
print(f'Used: {Fore.LIGHTGREEN_EX}{uz}{Fore.RESET} Gigabyte')
print(f'Free: {Fore.LIGHTGREEN_EX}{fz}{Fore.RESET} Gigabyte')