Merged
Conversation
- Changed default port from 8765 to 8766 in main.go. - Consolidated system-related API routes into a dedicated system package. - Moved system info handling to a new system/info package, including CPU, RAM, GPU, and Disk usage functionalities. - Removed unused system-related imports and functions from router.go. - Added new API endpoint for retrieving system information. - Implemented disk usage retrieval in a separate disk package. - Updated usage handling to utilize new CPU, RAM, and GPU info retrieval methods. - Removed redundant code and improved structure for better maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a significant refactor and enhancement of the system information APIs, focusing on modularizing system info endpoints, improving Linux player provider logic, and adding detailed hardware information gathering. The most notable changes include the restructuring of system API routes, the addition of new hardware info modules (CPU, RAM, disk, GPU, host), and improvements to player control logic for Linux. There are also dependency updates and a minor change to the default development server port.
System API Refactor and Modularization:
internal/api/router.goare now routed through a newsystem.SetupRoutes()method, removing direct imports and route registrations for individual system modules. This centralizes and simplifies system route management. [1] [2] [3]GetSystemInfoApi, is introduced for unified system info retrieval.New Hardware Information Modules:
internal/system/info/cpu/get_cpu_info.go: Gathers CPU usage, temperature, and wattage, with caching and DBus integration.internal/system/info/ram/ram.go: Provides RAM usage and memory statistics.internal/system/info/disk/disk.go: Reports disk usage and partition details for the root filesystem.internal/system/info/gpu/gpu.go: Collects GPU utilization, memory, and wattage, supporting both NVIDIA (via NVML andnvidia-smi) and integrated GPUs.internal/system/info/host/host.go: Retrieves host, OS, and user details, including CPU model and core count.Linux Player Provider Improvements:
internal/player/provider_linux.go) now dynamically selects the active MPRIS player viafindActivePlayerinstead of hardcoding Spotify, improving compatibility with multiple media players. [1] [2] [3] [4] [5] [6] [7] [8]Dependency Updates:
go.mod, includinggithub.com/godbus/dbus/v5,github.com/shirou/gopsutil/v3, and indirect dependencies for system/hardware info gathering.Miscellaneous:
8765to8766incmd/server/main.go.These changes collectively enhance the modularity, maintainability, and hardware awareness of the system, while also improving developer experience and compatibility.
References: