diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d75edea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv +__pycache__ \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..cde6917 --- /dev/null +++ b/main.py @@ -0,0 +1,25 @@ +from utils.utils_drive import Drive +from utils.globals import * + + +if OS_TYPE == "Windows": + import wmi + c = wmi.WMI() + drives = [] + if disks := c.Win32_DiskDrive(): + for disk in disks: + drives.append(Drive(disk.Model, disk.Name, disk.InterfaceType, disk.DefaultBlockSize, int(disk.Size))) +elif OS_TYPE == "Linux": + import subprocess + + # Execute the lsblk command to get information about block devices + result = subprocess.run(['lsblk', '-o', 'NAME,SIZE,MODEL,VENDOR,TRAN'], capture_output=True, text=True) + + # Get the output + output = result.stdout + + # Вывод информации о дисках + print(output) + +# for drive in drives: +# print(f"{drive.name} | {drive.path} | {drive.disk_type} | {drive.block_size} | {drive.capacity}") diff --git a/utils/globals.py b/utils/globals.py new file mode 100644 index 0000000..b98c469 --- /dev/null +++ b/utils/globals.py @@ -0,0 +1,3 @@ +import platform + +OS_TYPE = platform.system() \ No newline at end of file diff --git a/utils/utils_drive.py b/utils/utils_drive.py new file mode 100644 index 0000000..7f31813 --- /dev/null +++ b/utils/utils_drive.py @@ -0,0 +1,27 @@ +from utils.globals import OS_TYPE + +class Drive(): + + path: str + + total_sectors: str + + disk_type = None + + name: str + + block_size: int = 512 + + capacity: int + + def __init__(self, name , path, disk_type, block_size, capacity): + self.name = name + self.disk_type = disk_type + self.path = path + if block_size is not None: + self.block_size = block_size + self.capacity = capacity + + def erase(self): + pass +