Closed lockenkop closed 12 months ago
Great, I wanted to add this for a long time !
Example from BigSur:
Python 3.11.3 (v3.11.3:f3909b8bc8, Apr 4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.disk_partitions()
[sdiskpart(device='/dev/disk1s5s1', mountpoint='/', fstype='apfs', opts='ro,local,rootfs,dovolfs,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s4', mountpoint='/System/Volumes/VM', fstype='apfs', opts='rw,noexec,local,dovolfs,dontbrowse,journaled,multilabel,noatime', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s2', mountpoint='/System/Volumes/Preboot', fstype='apfs', opts='rw,local,dovolfs,dontbrowse,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s6', mountpoint='/System/Volumes/Update', fstype='apfs', opts='rw,local,dovolfs,dontbrowse,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk1s1', mountpoint='/System/Volumes/Data', fstype='apfs', opts='rw,local,dovolfs,dontbrowse,journaled,multilabel', maxfile=255, maxpath=1024), sdiskpart(device='/dev/disk0s4', mountpoint='/Volumes/Untitled', fstype='ntfs', opts='ro,local,ignore-ownership,multilabel', maxfile=255, maxpath=1024)]
>>> psutil.disk_usage("/")
sdiskusage(total=274999996416, used=15322058752, free=27211255808, percent=36.0)
Looks good to me.
Good. Do you plan adding also Windows support ?
I just got my Windows dev VM up and running. windows support for psutil.disk_* looks good. I'll cook something up.
Got Windows working. This
Add value for "which Drive shall be checked
is ugly af, that has to change
Had to do some reorganisation to make the config os agnostic.
Next Todo is handling wrong user input, at the time the config just crashes
Thank you for your work @lockenkop ! Contributions are always appreciated 🤝
64
I made the path that this Entity reads configurable.
I don't know how psutil.disk_partitions() and psutil.disk_usage() behaves in macos. Might get a macos VM going.