summarylogtreecommitdiffstats
path: root/capyfetch.py
blob: 37d5b39486beeab8c4303084f22b6b41a1a8028c (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
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import os
import platform
import psutil
import time
from datetime import timedelta
from colorama import Fore, Style
import distro 

def get_system_info():
    uname = platform.uname()

    boot_time = psutil.boot_time()
    current_time = time.time()
    
    uptime_seconds = current_time - boot_time
    
    uptime_hrs = int(uptime_seconds // 3600)
    uptime_min = int((uptime_seconds % 3600) // 60)
    
    uptime = f"{uptime_hrs} hours, {uptime_min} mins"
    
    memory = psutil.virtual_memory()
    
    return {
        "os": distro.name(),  # Получаем название дистрибутива
        "kernel": uname.release,
        "shell": os.environ.get("SHELL", "Unknown"),
        "uptime": uptime,
        "memory": f"{memory.used // (1024 ** 2)}MB / {memory.total // (1024 ** 2)}MB",
    }

def print_info():
    system_info = get_system_info()
    
    username = os.getlogin()
    pcname = platform.node() 
    
    print(Fore.YELLOW + f"    ⠀⠀⢀⣀⠤⠿⢤⢖⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      {username}@{pcname}")
    print(Fore.YELLOW + "    ⡔⢩⠂⠀⠒⠗⠈⠀⠉⠢⠄⣀⠠⠤⠄⠒⢖⡒⢒⠂⠤⢄⠀⠀⠀⠀      ━━━━━━━━━━━━━━━━")
    print(Fore.YELLOW + "    ⠇⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠈⠀⠈⠈⡨⢀⠡⡪⠢⡀⠀      ▪ " + Fore.WHITE + "os      " + system_info["os"])
    print(Fore.YELLOW + "    ⠈⠒⠀⠤⠤⣄⡆⡂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠢⠀⢕⠱⠀      ▪ " + Fore.WHITE + "kernel  " + system_info["kernel"])
    print(Fore.YELLOW + "    ⠀⠀⠀⠀⠀⠈⢳⣐⡐⠐⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠁⠇      ▪ " + Fore.WHITE + "shell   " + system_info["shell"])
    print(Fore.YELLOW + "    ⠀⠀⠀⠀⠀⠀⠀⠑⢤⢁⠀⠆⠀⠀⠀⠀⠀⢀⢰⠀⠀⠀⡀⢄⡜⠀      ▪ " + Fore.WHITE + "uptime  " + system_info["uptime"])
    print(Fore.YELLOW + "    ⠀⠀⠀⠀⠀⠀⠀⠀⠘⡦⠄⡷⠢⠤⠤⠤⠤⢬⢈⡇⢠⣈⣰⠎⠀⠀      ▪ " + Fore.WHITE + "memory  " + system_info["memory"])
    print(Fore.YELLOW + "    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣃⢸⡇⠀⠀⠀⠀⠀⠈⢪⢀⣺⡅⢈⠆⠀⠀")
    print(Fore.YELLOW + "    ⠀⠀⠀⠀⠀⠀⠀⠶⡿⠤⠚⠁⠀⠀⠀⢀⣠⡤⢺⣥⠟⢡⠃⠀⠀⠀") 
    print(Fore.YELLOW + "    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀")
    print(Style.RESET_ALL)

if __name__ == "__main__":
    print_info()