nwithan8 / tauticord

A Discord bot that displays live data from Tautulli
GNU General Public License v3.0
114 stars 22 forks source link

[feat] Get CPU, memory stats directly from Plex #224

Closed nwithan8 closed 4 months ago

nwithan8 commented 4 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 4 months ago
Walkthrough ## Walkthrough The latest update enhances Tauticord's performance monitoring by connecting directly to the Plex Media Server instead of Tautulli. This modification streamlines the retrieval of performance statistics. Documentation was updated to include SQL query enabling instructions and risks. Additionally, the `system_stats.py` module was significantly refactored, and the `performance_stats.py` and `tautulli_connector.py` modules received method overhauls to facilitate the new connection strategy. The `requirements.txt` was also adjusted to reflect the updated Tautulli version requirement. ## Changes | File | Change Summary | |-----------------------------------|--------------------------------------------------------------------------------| | `documentation/DOCUMENTATION.md` | Updated instructions, risks, and connection information related to Plex Server. | | `modules/system_stats.py` | Refactored CPU and RAM usage functions and removed specific functions. | | `modules/tasks/performance_stats.py` | Added new calculation methods and refactored logic for performance stats update.| | `modules/tautulli/tautulli_connector.py` | Refactored Plex details retrieval and added error handling. | | `requirements.txt` | Updated Tautulli version requirement to `4.3.*`. |

Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 439465fef576a701e5b621f3cb047cf044f5e0d1 and 3b94249f5ceb100256b5bc6278b8b91fe5e1b856.
Files selected for processing (5) * documentation/DOCUMENTATION.md (2 hunks) * modules/system_stats.py (1 hunks) * modules/tasks/performance_stats.py (3 hunks) * modules/tautulli/tautulli_connector.py (1 hunks) * requirements.txt (1 hunks)
Files skipped from review due to trivial changes (1) * requirements.txt
Additional context used
LanguageTool
documentation/DOCUMENTATION.md
[style] ~244-~244: Consider a shorter alternative to avoid wordiness. Context: ...ia Server to collect this information. In order to establish a connection to the Plex Medi... (IN_ORDER_TO_PREMIUM) --- [style] ~246-~246: Consider a shorter alternative to avoid wordiness. Context: ...ex token stored in Tautulli's database. In order to retrieve this token, SQL queries must b... (IN_ORDER_TO_PREMIUM)
Additional comments not posted (6)
modules/tasks/performance_stats.py (5)
`1-2`: **Imports look good.** The imports for `List` and `plexapi.server` are necessary for the new methods and are correctly added. Also applies to: 4-4 --- `34-49`: **Error handling and logic look good.** The function correctly handles errors when the Plex API is not available and retrieves CPU usage from the Plex API. --- `50-64`: **Error handling and logic look good.** The function correctly handles errors when the Plex API is not available and retrieves memory usage from the Plex API. --- `66-72`: **Error handling and logic look good.** The function correctly handles errors when the specified path does not exist and retrieves disk usage information. --- `88-102`: **Logic and integration look good.** The function correctly updates performance stats for CPU, memory, and disk usage by calling the new methods.
modules/tautulli/tautulli_connector.py (1)
`48-53`: **New attributes and error handling look good.** The new attributes `has_plex_pass` and `plex_api` are correctly added, and the error handling for Plex API preparation is appropriate.
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.