-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[chore] Add Tautulli v2.15.0 support #54
Conversation
📝 Walkthrough## Walkthrough
The pull request introduces several changes across multiple files. The `API_VERSIONS.json` file is updated to include a new API version "2.15.0." The `export_metadata` method in the `RawAPI` class is modified to accept an additional parameter, `logo_level`. The `DatumModel` class gains a new optional attribute `logo_level`. Additionally, the `MetadataModel` class is expanded with new attributes and properties, including a new `MarkerModel` class, enhancing the media categorization and URL generation capabilities.
## Changes
| File Path | Change Summary |
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| tautulli/API_VERSIONS.json | - Added new version: `"2.15.0"` <br> - Removed versions: `"2.14.0-beta"`, `"2.14.0"`, `"2.14.1-beta"`, `"2.14.1"` <br> - Retained version: `"2.14.6"` |
| tautulli/api/json_api.py | - Updated method signature of `export_metadata` in `RawAPI` to include `logo_level: int = 0`. <br> - Adjusted `params` dictionary to include `logo_level`. |
| tautulli/models/exports_table.py | - Added new optional attribute: `logo_level: Optional[int] = None` in `DatumModel`. |
| tautulli/models/metadata.py | - Added new class: `MarkerModel` with optional attributes. <br> - Expanded `MetadataModel` with new optional attributes: `slug`, `parent_slug`, `grandparent_slug`. <br> - Added multiple properties for media type categorization. <br> - Added properties for URL generation. |
## Possibly related PRs
- #53: The changes in this PR also involve an update to the `tautulli/API_VERSIONS.json` file, specifically adding the version "2.14.6", which is directly related to the versioning updates in the main PR that added "2.15.0". Warning Rate limit exceeded@nwithan8 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 27 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
tautulli/models/metadata.py (2)
Line range hint
86-94
: Consider adding validation rules for time offsetsThe
MarkerModel
looks good, but consider adding validation rules to ensure:
start_time_offset
is non-negativeend_time_offset
is greater thanstart_time_offset
class MarkerModel(BaseModel): id: Optional[int] = None type: Optional[str] = None - start_time_offset: Optional[int] = None - end_time_offset: Optional[int] = None + start_time_offset: Optional[conint(ge=0)] = None # type: ignore + end_time_offset: Optional[conint(ge=0)] = None # type: ignore first: Optional[bool] = None final: Optional[bool] = None + + @validator('end_time_offset') + def end_time_must_be_after_start(cls, v, values): + if v is not None and values.get('start_time_offset') is not None: + if v <= values['start_time_offset']: + raise ValueError('end_time_offset must be greater than start_time_offset') + return v
151-153
: Add validation for slug formatThe new slug fields should follow a consistent format. Consider adding validation to ensure slugs follow URL-safe patterns.
+from pydantic import constr class MetadataModel(BaseModel): - slug: Optional[str] = None - parent_slug: Optional[str] = None - grandparent_slug: Optional[str] = None + slug: Optional[constr(regex=r'^[a-z0-9-]+$')] = None # type: ignore + parent_slug: Optional[constr(regex=r'^[a-z0-9-]+$')] = None # type: ignore + grandparent_slug: Optional[constr(regex=r'^[a-z0-9-]+$')] = None # type: ignoretautulli/api/json_api.py (1)
Update object_api.py to maintain API consistency
The verification revealed that
object_api.py
also implements theexport_metadata
method but lacks the newlogo_level
parameter. This needs to be synchronized withjson_api.py
to maintain API consistency across both implementations.
tautulli/api/object_api.py
: Add thelogo_level
parameter with default value of 0 to match the implementation injson_api.py
🔗 Analysis chain
Line range hint
641-686
: Verify existing usage of export_metadataWhile the changes look good and maintain backward compatibility due to the default value, let's verify any existing usage of this method in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for existing calls to export_metadata to ensure they won't be affected # Search for direct method calls echo "Checking for direct method calls to export_metadata:" rg "export_metadata\(" --type python # Search for method references echo "Checking for method references:" rg "export_metadata" --type pythonLength of output: 323
Script:
#!/bin/bash # Search for direct method calls without file type restriction echo "Checking for direct method calls to export_metadata:" rg "export_metadata\(" # Search for method references echo "Checking for method references:" rg "export_metadata"Length of output: 1073
Script:
#!/bin/bash # Check the test files to see how export_metadata is being used echo "Content of test_json_api.py test:" rg -A 10 "test_export_metadata" tests/test_json_api.py echo "Content of test_object_api.py test:" rg -A 10 "test_export_metadata" tests/test_object_api.py # Check the object_api implementation to compare parameters echo "Content of object_api.py export_metadata method signature:" rg -A 5 "def export_metadata" tautulli/api/object_api.pyLength of output: 1333
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
tautulli/API_VERSIONS.json
(1 hunks)tautulli/api/json_api.py
(3 hunks)tautulli/models/exports_table.py
(1 hunks)tautulli/models/metadata.py
(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- tautulli/API_VERSIONS.json
🔇 Additional comments (5)
tautulli/models/exports_table.py (1)
24-24
: LGTM! The new field follows the established pattern.
The addition of logo_level
as an optional integer field aligns well with the existing level parameters like art_level
, thumb_level
, and metadata_level
.
Let's verify the schema generation setup:
✅ Verification successful
The logo_level
field is properly integrated and used consistently
The verification shows that:
- The field is correctly added to the exports table model
- It's properly used in the API implementation (
json_api.py
) with matching type hints and documentation - The parameter is correctly passed through to the export functionality
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for schema generation configuration and related files
# Expected: Find the source JSON schema and generation config
# Look for datamodel-codegen configuration
fd -t f "datamodel.*\.toml|pyproject\.toml"
# Find the source JSON schema file
fd "data\.json" -t f
# Check if there are other generated model files that might need the same update
fd ".*_table\.py$" -t f
Length of output: 265
Script:
#!/bin/bash
# Let's check if logo_level is consistently used across table models
# and look for any schema/generation files in the root directories
# Check for logo_level usage in other table models
rg "logo_level" --type py
# Look for schema files in common locations
fd -t f "schema.*\.json"
# Check root level directories for any generation related files
ls -la
Length of output: 1809
tautulli/models/metadata.py (1)
155-185
: LGTM! Well-structured media type properties
The media type properties are well-implemented with clear, consistent checks.
tautulli/api/json_api.py (3)
641-641
: LGTM: Parameter addition follows existing pattern
The addition of the logo_level
parameter with a default value of 0 follows the existing pattern of optional parameters in the method signature.
667-668
: LGTM: Well-documented parameter
The docstring for the new parameter clearly describes its purpose and type, maintaining consistency with the existing documentation style.
686-686
: LGTM: Proper parameter handling
The logo_level
parameter is correctly added to the optional parameters dictionary using the existing build_optional_params
helper function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
tautulli/models/metadata.py (2)
Line range hint
86-93
: Consider adding validation rules for time offsetsThe
MarkerModel
looks good, but consider adding validation to ensure:
start_time_offset
is non-negativeend_time_offset
is greater thanstart_time_offset
class MarkerModel(BaseModel): id: Optional[int] = None type: Optional[str] = None - start_time_offset: Optional[int] = None - end_time_offset: Optional[int] = None + start_time_offset: Optional[conint(ge=0)] = None # type: ignore + end_time_offset: Optional[conint(ge=0)] = None # type: ignore first: Optional[bool] = None final: Optional[bool] = None + + @validator('end_time_offset') + def end_time_must_be_after_start(cls, v, values): + if v is not None and values.get('start_time_offset') is not None: + if v <= values['start_time_offset']: + raise ValueError('end_time_offset must be greater than start_time_offset') + return v
155-185
: Use an enum for media typesConsider using an enum for
media_type
to ensure type safety and prevent typos. This would also make it easier to maintain the list of valid media types.+from enum import Enum + +class MediaType(str, Enum): + MOVIE = "movie" + SHOW = "show" + SEASON = "season" + EPISODE = "episode" + ARTIST = "artist" + ALBUM = "album" + TRACK = "track" + CLIP = "clip" class MetadataModel(BaseModel): - media_type: Optional[str] = None + media_type: Optional[MediaType] = None @property def is_movie(self) -> bool: - return self.media_type == "movie" + return self.media_type == MediaType.MOVIE # Update other properties similarly
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
tautulli/api/object_api.py
(2 hunks)tautulli/models/metadata.py
(3 hunks)
🔇 Additional comments (1)
tautulli/api/object_api.py (1)
452-452
: LGTM! The logo_level
parameter is well-implemented.
The addition of the logo_level
parameter is consistent with the existing level parameters and properly documented.
Also applies to: 478-479
logo_level
parameter forexport_metadata
slug
,parent_slug
andgrandparent_slug
toMetadata
modelSummary by CodeRabbit
New Features
logo_level
parameter in the metadata export functionality, allowing users to specify the level of logo images to export.MetadataModel
with new properties for more detailed media categorization and URL generation for Plex content.Bug Fixes
Documentation