diff options
author | ksooo <3226626+ksooo@users.noreply.github.com> | 2024-08-15 12:34:21 +0200 |
---|---|---|
committer | ksooo <3226626+ksooo@users.noreply.github.com> | 2024-08-15 19:28:27 +0200 |
commit | 01775f45c389fc71fe945e10c3b8ad43293ecae6 (patch) | |
tree | 6e955efc4e67485252120a76d87ddb9359e5e1d7 | |
parent | e46c19e5b85c5c501d9d7d4faca5bc58aef11f76 (diff) |
[addons][PVR] PVR Addon-API: Add PVR_RECORDING::iParentalRating, PVR_RECORDING::strParentalRatingCode, PVR_RECORDING::strParentalRatingIcon, PVR_RECORDING::strParentalRatingSource.
3 files changed, 73 insertions, 1 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h index e1ec4637ca..0e92263ec2 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr/Recordings.h @@ -96,6 +96,10 @@ public: /// | **Size in bytes** | `std::string` | @ref PVRRecording::SetSizeInBytes "SetSizeInBytes" | @ref PVRRecording::GetSizeInBytes "GetSizeInBytes" | *optional* /// | **Client provider unique identifier** | `int` | @ref PVRChannel::SetClientProviderUid "SetClientProviderUid" | @ref PVRTimer::GetClientProviderUid "GetClientProviderUid" | *optional* /// | **Provider name** | `std::string` | @ref PVRChannel::SetProviderName "SetProviderlName" | @ref PVRChannel::GetProviderName "GetProviderName" | *optional* + /// | **Parental rating age** | `unsigned int` | @ref PVRRecording::SetParentalRating "SetParentalRating" | @ref PVRRecording::GetParentalRating "GetParentalRating" | *optional* + /// | **Parental rating code** | `std::string` | @ref PVRRecording::SetParentalRatingCode "SetParentalRatingCode" | @ref PVRRecording::GetParentalRatingCode "GetParentalRatingCode" | *optional* + /// | **Parental rating icon** | `std::string` | @ref PVRRecording::SetParentalRatingIcon "SetParentalRatingIcon" | @ref PVRRecording::GetParentalRatingIcon "GetParentalRatingIcon" | *optional* + /// | **Parental rating source** | `std::string` | @ref PVRRecording::SetParentalRatingSource "SetParentalRatingSource" | @ref PVRRecording::GetParentalRatingSource "GetParentalRatingSource" | *optional* /// @addtogroup cpp_kodi_addon_pvr_Defs_Recording_PVRRecording ///@{ @@ -512,6 +516,55 @@ public: return m_cStructure->strProviderName ? m_cStructure->strProviderName : ""; } + /// @brief **optional**\n + /// Age rating for the recording. + void SetParentalRating(unsigned int iParentalRating) + { + m_cStructure->iParentalRating = iParentalRating; + } + + /// @brief To get with @ref SetParentalRating changed values + unsigned int GetParentalRating() const { return m_cStructure->iParentalRating; } + + /// @brief **optional**\n + /// Parental rating code for this recording. + void SetParentalRatingCode(const std::string& ratingCode) + { + ReallocAndCopyString(&m_cStructure->strParentalRatingCode, ratingCode.c_str()); + } + + /// @brief To get with @ref SetParentalRatingCode changed values. + std::string GetParentalRatingCode() const + { + return m_cStructure->strParentalRatingCode ? m_cStructure->strParentalRatingCode : ""; + } + + /// @brief **optional**\n + /// Parental rating icon for this recording. + void SetParentalRatingIcon(const std::string& ratingIcon) + { + ReallocAndCopyString(&m_cStructure->strParentalRatingIcon, ratingIcon.c_str()); + } + + /// @brief To get with @ref SetParentalRatingIcon changed values. + std::string GetParentalRatingIcon() const + { + return m_cStructure->strParentalRatingIcon ? m_cStructure->strParentalRatingIcon : ""; + } + + /// @brief **optional**\n + /// Parental rating source for this recording. + void SetParentalRatingSource(const std::string& ratingSource) + { + ReallocAndCopyString(&m_cStructure->strParentalRatingSource, ratingSource.c_str()); + } + + /// @brief To get with @ref SetParentalRatingSource changed values. + std::string GetParentalRatingSource() const + { + return m_cStructure->strParentalRatingSource ? m_cStructure->strParentalRatingSource : ""; + } + static void AllocResources(const PVR_RECORDING* source, PVR_RECORDING* target) { target->strRecordingId = AllocAndCopyString(source->strRecordingId); @@ -527,6 +580,9 @@ public: target->strFanartPath = AllocAndCopyString(source->strFanartPath); target->strFirstAired = AllocAndCopyString(source->strFirstAired); target->strProviderName = AllocAndCopyString(source->strProviderName); + target->strParentalRatingCode = AllocAndCopyString(source->strParentalRatingCode); + target->strParentalRatingIcon = AllocAndCopyString(source->strParentalRatingIcon); + target->strParentalRatingSource = AllocAndCopyString(source->strParentalRatingSource); } static void FreeResources(PVR_RECORDING* target) @@ -544,6 +600,9 @@ public: FreeString(target->strFanartPath); FreeString(target->strFirstAired); FreeString(target->strProviderName); + FreeString(target->strParentalRatingCode); + FreeString(target->strParentalRatingIcon); + FreeString(target->strParentalRatingSource); } private: diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h index 8c57f33e2a..ae9d2a52fa 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_recordings.h @@ -139,6 +139,10 @@ extern "C" int64_t sizeInBytes; int iClientProviderUid; const char* strProviderName; + unsigned int iParentalRating; + const char* strParentalRatingCode; + const char* strParentalRatingIcon; + const char* strParentalRatingSource; } PVR_RECORDING; #ifdef __cplusplus diff --git a/xbmc/pvr/addons/PVRClient.cpp b/xbmc/pvr/addons/PVRClient.cpp index 0b5a83af5f..e7490b481f 100644 --- a/xbmc/pvr/addons/PVRClient.cpp +++ b/xbmc/pvr/addons/PVRClient.cpp @@ -122,7 +122,10 @@ public: m_thumbnailPath(recording.ClientThumbnailPath()), m_fanartPath(recording.ClientFanartPath()), m_firstAired(recording.FirstAired().IsValid() ? recording.FirstAired().GetAsW3CDate() : ""), - m_providerName(recording.ProviderName()) + m_providerName(recording.ProviderName()), + m_parentalRatingCode(""), //! @todo + m_parentalRatingIcon(""), //! @todo + m_parentalRatingSource("") //! @todo { time_t recTime; recording.RecordingTimeAsUTC().GetAsTime(recTime); @@ -161,6 +164,9 @@ public: sizeInBytes = recording.GetSizeInBytes(); strProviderName = m_providerName.c_str(); iClientProviderUid = recording.ClientProviderUniqueId(); + strParentalRatingCode = m_parentalRatingCode.c_str(); + strParentalRatingIcon = m_parentalRatingIcon.c_str(); + strParentalRatingSource = m_parentalRatingSource.c_str(); } virtual ~CAddonRecording() = default; @@ -178,6 +184,9 @@ private: const std::string m_fanartPath; const std::string m_firstAired; const std::string m_providerName; + const std::string m_parentalRatingCode; + const std::string m_parentalRatingIcon; + const std::string m_parentalRatingSource; }; class CAddonTimer : public PVR_TIMER |