first commit

This commit is contained in:
2025-04-07 07:44:27 -07:00
commit d6cde0c05e
512 changed files with 142392 additions and 0 deletions

63
OLD - cputemp copy.py Normal file
View File

@@ -0,0 +1,63 @@
# import clr # from pythonnet
# import os
# import sys
# # Path to the LibreHardwareMonitor DLL
# dll_path = r"LibreHardwareMonitorLib.dll"
# sys.path.append(os.path.dirname(dll_path))
# clr.AddReference("LibreHardwareMonitorLib")
# from LibreHardwareMonitor.Hardware import Computer
# def get_cpu_temperature():
# computer = Computer()
# computer.IsCpuEnabled = True
# computer.Open()
# temperatures = []
# print(computer.Hardware.CPU)
# return 80
# for hardware in computer.Hardware:
# if hardware.HardwareType.ToString() == "Cpu":
# hardware.Update()
# for sensor in hardware.Sensors:
# if sensor.SensorType.ToString() == "Temperature":
# print(f"{sensor.Name}: {sensor.Value} °C")
# temperatures.append(sensor.Value)
# computer.Close()
# return max(temperatures) if temperatures else None
# temp = get_cpu_temperature()
# if temp:
# print(f"Highest CPU temperature: {temp} °C")
# else:
# print("No CPU temperatures found.")
from PyLibreHardwareMonitor import Computer
# Get system information, automatically refreshed with each call.
def get_cpu_data( ):
computer = Computer()
cpu_temps = { }
cpu_usage = { }
cpu_combined = { }
for mobo in computer.motherboard:
print(computer.motherboard[mobo])
for cpu in computer.cpu:
#print(computer.cpu[cpu])
for core in computer.cpu[cpu]['Load']:
#print(core)
if core.find("CPU Core #") != -1 and len(core) <= len("CPU Core #10"):
cpu_combined[core] = {'load' : computer.cpu[cpu]['Load'][core]}
for core in computer.cpu[cpu]['Temperature']:
#print(core, computer.cpu[cpu]['Temperature'][core])
if core.find("CPU Core #") != -1 and len(core) <= len("CPU Core #10"):
cpu_combined[core]['temp'] = computer.cpu[cpu]['Temperature'][core]
return cpu_combined #{'Temperatures' : cpu_temps, 'Loads' : cpu_usage}
print(get_cpu_data( ))