From 67137e78c91f639e35801f480d22a4436bea5d6e Mon Sep 17 00:00:00 2001 From: Nate Harris Date: Fri, 19 Apr 2024 01:41:47 -0600 Subject: [PATCH] [chore] v2.14.0-beta compatibility (#45) - Add Dolby Vision info to media info - Add before and after parameters to get_home_stats - Add live TV metadata from EPG to response - Drop compatibility with Tautulli v2.12 and v2.13 --- tautulli/API_VERSIONS.json | 12 +----------- tautulli/api/json_api.py | 11 +++++++++-- tautulli/api/object_api.py | 12 ++++++++---- tautulli/models/activity.py | 3 +++ tautulli/models/metadata.py | 10 ++++++++++ 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/tautulli/API_VERSIONS.json b/tautulli/API_VERSIONS.json index 9651319..039ec39 100644 --- a/tautulli/API_VERSIONS.json +++ b/tautulli/API_VERSIONS.json @@ -1,13 +1,3 @@ [ - "2.12.0", - "2.12.1", - "2.12.2", - "2.12.3", - "2.12.4", - "2.12.5", - "2.13.0", - "2.13.1", - "2.13.2", - "2.13.3", - "2.13.4" + "2.14.0-beta" ] diff --git a/tautulli/api/json_api.py b/tautulli/api/json_api.py index 92084b8..eb6840f 100644 --- a/tautulli/api/json_api.py +++ b/tautulli/api/json_api.py @@ -916,7 +916,8 @@ def get_history(self, grouping: bool = False, include_activity: bool = False, us @raw_json def get_home_stats(self, grouping: bool = False, time_range: int = 30, stats_type: str = 'plays', start: int = 0, - count: int = 5, stat_id: str = None, user_id: int = None, section_id: int = None) -> List[dict]: + count: int = 5, stat_id: str = None, user_id: int = None, section_id: int = None, + before: datetime = None, after: datetime = None) -> List[dict]: """ Get the homepage watch statistics @@ -936,6 +937,10 @@ def get_home_stats(self, grouping: bool = False, time_range: int = 30, stats_typ :type user_id: int, optional :param section_id: The ID of the Plex library section :type section_id: int, optional + :param before: Results before and including the date + :type before: datetime, optional + :param after: Results after and including the date + :type after: datetime, optional :returns: List of data :rtype: List[dict] """ @@ -946,9 +951,11 @@ def get_home_stats(self, grouping: bool = False, time_range: int = 30, stats_typ if _is_invalid_choice(value=stat_id, variable_name='stat_id', choices=static.stats_category): return False, None + before = datetime_to_string(datetime_object=before) + after = datetime_to_string(datetime_object=after) params = build_optional_params(grouping=grouping, time_range=time_range, stats_type=stats_type, stats_start=start, stats_count=count, stat_id=stat_id, section_id=section_id, - user_id=user_id) + user_id=user_id, before=before, after=after) return 'get_home_stats', params @raw_json diff --git a/tautulli/api/object_api.py b/tautulli/api/object_api.py index ace3c70..72188ef 100644 --- a/tautulli/api/object_api.py +++ b/tautulli/api/object_api.py @@ -644,8 +644,8 @@ def get_history(self, grouping: bool = False, include_activity: bool = False, us @make_object def get_home_stats(self, grouping: bool = False, time_range: int = 30, stats_type: str = 'plays', start: int = 0, - count: int = 5, stat_id: str = None, user_id: int = None, section_id: int = None) -> List[ - HomeStat]: + count: int = 5, stat_id: str = None, user_id: int = None, section_id: int = None, + before: datetime = None, after: datetime = None) -> List[HomeStat]: """ Get the homepage watch statistics @@ -665,13 +665,17 @@ def get_home_stats(self, grouping: bool = False, time_range: int = 30, stats_typ :type user_id: int, optional :param section_id: The ID of the Plex library section :type section_id: int, optional + :param before: Results before and including the date + :type before: datetime, optional + :param after: Results after and including the date + :type after: datetime, optional :returns: List of HomeStat object """ return 'HomeStat' @make_object - def get_item_user_stats(self, rating_key: str, grouping: bool = False, media_type: str = None) -> List[ - ItemUserStat]: + def get_item_user_stats(self, rating_key: str, grouping: bool = False, media_type: str = None) \ + -> List[ItemUserStat]: """ Get the user statistics for the media item diff --git a/tautulli/models/activity.py b/tautulli/models/activity.py index 0258dc2..d23d0d6 100644 --- a/tautulli/models/activity.py +++ b/tautulli/models/activity.py @@ -84,8 +84,11 @@ class SessionModel(BaseModel): audio_profile: Optional[str] = None optimized_version: Optional[int] = None channel_call_sign: Optional[str] = None + channel_id: Optional[str] = None channel_identifier: Optional[str] = None + channel_title: Optional[str] = None channel_thumb: Optional[str] = None + channel_vcn: Optional[str] = None file: Optional[str] = None file_size: Optional[str] = None indexes: Optional[int] = None diff --git a/tautulli/models/metadata.py b/tautulli/models/metadata.py index d531b15..1eb565c 100644 --- a/tautulli/models/metadata.py +++ b/tautulli/models/metadata.py @@ -22,6 +22,13 @@ class StreamModel(BaseModel): video_color_space: Optional[str] = None video_color_trc: Optional[str] = None video_dynamic_range: Optional[str] = None + video_dovi_bl_present: Optional[int] = None + video_dovi_el_present: Optional[int] = None + video_dovi_level: Optional[int] = None + video_dovi_present: Optional[int] = None + video_dovi_profile: Optional[int] = None + video_dovi_rpu_present: Optional[int] = None + video_dovi_version: Optional[float] = None video_frame_rate: Optional[str] = None video_ref_frames: Optional[str] = None video_height: Optional[str] = None @@ -69,8 +76,11 @@ class MediaInfoItemModel(BaseModel): audio_profile: Optional[str] = None optimized_version: Optional[int] = None channel_call_sign: Optional[str] = None + channel_id: Optional[str] = None channel_identifier: Optional[str] = None + channel_title: Optional[str] = None channel_thumb: Optional[str] = None + channel_vcn: Optional[str] = None parts: Optional[List[PartModel]] = None class MarkerModel(BaseModel):