diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp index 5cce422f..809041e3 100644 --- a/src/Tvheadend.cpp +++ b/src/Tvheadend.cpp @@ -892,7 +892,7 @@ struct TimerType : kodi::addon::PVRTimerType unsigned int id, unsigned int attributes, const std::string& description, - const std::vector& customIntSettingDefs, + const std::vector& customSettingDefs, const std::vector& priorityValues, const std::vector& lifetimeValues, const std::vector& dupEpisodesValues = @@ -901,7 +901,7 @@ struct TimerType : kodi::addon::PVRTimerType SetId(id); SetAttributes(attributes); SetDescription(description); - SetCustomIntSettingDefinitions(customIntSettingDefs); + SetCustomSettingDefinitions(customSettingDefs); SetPriorities(priorityValues, settings->GetDvrPriority()); SetLifetimes(lifetimeValues, LifetimeMapper::TvhToKodi(settings->GetDvrLifetime())); SetPreventDuplicateEpisodes(dupEpisodesValues, settings->GetDvrDupdetect()); @@ -1004,8 +1004,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type /* Timer types definition. */ - /* Custom integer setting definitions */ - const std::vector customIntSettingDefs{ + /* Custom setting definitions */ + const std::vector customSettingDefs{ m_customTimerProps.GetSettingDefinitions()}; /* One-shot manual (time and channel based) */ @@ -1018,8 +1018,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type TIMER_ONCE_MANUAL_ATTRIBS, /* Let Kodi generate the description. */ "", - /* Custom int settings definitions. */ - customIntSettingDefs, + /* Custom settings definitions. */ + customSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ @@ -1035,8 +1035,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type TIMER_ONCE_EPG_ATTRIBS, /* Let Kodi generate the description. */ "", - /* Custom int settings definitions. */ - customIntSettingDefs, + /* Custom settings definitions. */ + customSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ @@ -1052,8 +1052,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type TIMER_ONCE_MANUAL_ATTRIBS | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, /* Description. */ kodi::addon::GetLocalizedString(30350), // "One Time (Scheduled by timer rule)" - /* Custom int settings definitions. */ - customIntSettingDefs, + /* Custom settings definitions. */ + customSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ @@ -1069,16 +1069,16 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type TIMER_ONCE_EPG_ATTRIBS | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, /* Description. */ kodi::addon::GetLocalizedString(30350), // "One Time (Scheduled by timer rule)" - /* Custom int settings definitions. */ - customIntSettingDefs, + /* Custom settings definitions. */ + customSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ lifetimeValues)); - /* Custom Timerec integer setting definitions */ - const std::vector customTimeRecIntSettingDefs{ - m_timeRecordings.GetCustomIntSettingDefinitions()}; + /* Custom Timerec setting definitions */ + const std::vector customTimeRecSettingDefs{ + m_timeRecordings.GetCustomSettingDefinitions()}; /* Repeating manual (time and channel based) - timerec */ types.emplace_back(TimerType( @@ -1094,16 +1094,16 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type PVR_TIMER_TYPE_SUPPORTS_LIFETIME | PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS, /* Let Kodi generate the description. */ "", - /* Custom int settings definitions. */ - customTimeRecIntSettingDefs, + /* Custom settings definitions. */ + customTimeRecSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ lifetimeValues)); /* Custom Autorec integer setting definitions */ - const std::vector customAutoRecIntSettingDefs{ - m_autoRecordings.GetCustomIntSettingDefinitions()}; + const std::vector customAutoRecSettingDefs{ + m_autoRecordings.GetCustomSettingDefinitions()}; if (m_conn->GetProtocol() >= 29) { @@ -1132,8 +1132,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type TIMER_REPEATING_SERIESLINK_ATTRIBS, /* Description. */ kodi::addon::GetLocalizedString(30369), // "Timer rule (series link)" - /* Custom int settings definitions. */ - customAutoRecIntSettingDefs, + /* Custom settings definitions. */ + customAutoRecSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ @@ -1166,8 +1166,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type TIMER_REPEATING_EPG_ATTRIBS, /* Let Kodi generate the description. */ "", - /* Custom int settings definitions. */ - customAutoRecIntSettingDefs, + /* Custom settings definitions. */ + customAutoRecSettingDefs, /* Values definitions for priorities. */ priorityValues, /* Values definitions for lifetime. */ @@ -1228,8 +1228,8 @@ bool CTvheadend::CreateTimer(const Recording& tvhTmr, kodi::addon::PVRTimer& tmr ? m_autoRecordings.GetTimerIntIdFromStringId(tvhTmr.GetAutorecId()) : 0); - /* Custom integer props */ - tmr.SetCustomIntProperties(m_customTimerProps.GetProperties(tvhTmr)); + /* Custom props */ + tmr.SetCustomProperties(m_customTimerProps.GetProperties(tvhTmr)); return true; } @@ -1314,8 +1314,8 @@ PVR_ERROR CTvheadend::AddTimer(const kodi::addon::PVRTimer& timer) LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from disk htsmsg_add_u32(m, "priority", timer.GetPriority()); - /* Custom integer props. */ - m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomIntProperties(), m); + /* Custom props. */ + m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomProperties(), m); /* Send and Wait */ { @@ -1450,8 +1450,8 @@ PVR_ERROR CTvheadend::UpdateTimer(const kodi::addon::PVRTimer& timer) LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from disk htsmsg_add_u32(m, "priority", timer.GetPriority()); - /* Custom integer props. */ - m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomIntProperties(), m); + /* Custom props. */ + m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomProperties(), m); return SendDvrUpdate(m); } diff --git a/src/tvheadend/AutoRecordings.cpp b/src/tvheadend/AutoRecordings.cpp index 82485f1c..bd28bc9f 100644 --- a/src/tvheadend/AutoRecordings.cpp +++ b/src/tvheadend/AutoRecordings.cpp @@ -110,8 +110,8 @@ void AutoRecordings::GetAutorecTimers(std::vector& timers tmr.SetFullTextEpgSearch(rec.second.GetFulltext()); tmr.SetParentClientIndex(0); - /* Custom integer props. */ - tmr.SetCustomIntProperties(m_customTimerProps.GetProperties(rec.second)); + /* Custom props. */ + tmr.SetCustomProperties(m_customTimerProps.GetProperties(rec.second)); timers.emplace_back(std::move(tmr)); } @@ -141,8 +141,8 @@ const std::string AutoRecordings::GetTimerStringIdFromIntId(unsigned int intId) return ""; } -const std::vector AutoRecordings:: - GetCustomIntSettingDefinitions() const +const std::vector AutoRecordings::GetCustomSettingDefinitions() + const { return m_customTimerProps.GetSettingDefinitions(); } @@ -273,8 +273,8 @@ PVR_ERROR AutoRecordings::SendAutorecAddOrUpdate(const kodi::addon::PVRTimer& ti if (timer.GetTimerType() == TIMER_REPEATING_SERIESLINK) htsmsg_add_str(m, "serieslinkUri", timer.GetSeriesLink().c_str()); - /* Custom integer props. */ - m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomIntProperties(), m); + /* Custom props. */ + m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomProperties(), m); /* Send and Wait */ { diff --git a/src/tvheadend/AutoRecordings.h b/src/tvheadend/AutoRecordings.h index ce42e990..88a62abe 100644 --- a/src/tvheadend/AutoRecordings.h +++ b/src/tvheadend/AutoRecordings.h @@ -45,7 +45,7 @@ class AutoRecordings int GetAutorecTimerCount() const; void GetAutorecTimers(std::vector& timers); const unsigned int GetTimerIntIdFromStringId(const std::string& strId) const; - const std::vector GetCustomIntSettingDefinitions() const; + const std::vector GetCustomSettingDefinitions() const; /* client to server messages */ PVR_ERROR SendAutorecAdd(const kodi::addon::PVRTimer& timer); diff --git a/src/tvheadend/CustomTimerProperties.cpp b/src/tvheadend/CustomTimerProperties.cpp index 0275522e..aefa2fc6 100644 --- a/src/tvheadend/CustomTimerProperties.cpp +++ b/src/tvheadend/CustomTimerProperties.cpp @@ -28,10 +28,10 @@ CustomTimerProperties::CustomTimerProperties(const std::vector& pr { } -std::vector CustomTimerProperties::GetProperties( +std::vector CustomTimerProperties::GetProperties( const tvheadend::entity::Recording& rec) const { - std::vector customProps; + std::vector customProps; for (unsigned int propId : m_propIds) { switch (propId) @@ -55,10 +55,10 @@ std::vector CustomTimerProperties::GetPropertie return customProps; } -std::vector CustomTimerProperties::GetProperties( +std::vector CustomTimerProperties::GetProperties( const tvheadend::entity::AutoRecording& autorec) const { - std::vector customProps; + std::vector customProps; for (unsigned int propId : m_propIds) { switch (propId) @@ -90,10 +90,10 @@ std::vector CustomTimerProperties::GetPropertie return customProps; } -std::vector CustomTimerProperties::GetProperties( +std::vector CustomTimerProperties::GetProperties( const tvheadend::entity::TimeRecording& timerec) const { - std::vector customProps; + std::vector customProps; for (unsigned int propId : m_propIds) { switch (propId) @@ -117,10 +117,10 @@ std::vector CustomTimerProperties::GetPropertie return customProps; } -const std::vector CustomTimerProperties:: - GetSettingDefinitions() const +const std::vector CustomTimerProperties::GetSettingDefinitions() + const { - std::vector ret; + std::vector ret; for (unsigned int propId : m_propIds) { @@ -221,7 +221,7 @@ const std::vector CustomTimerProperties::GetPossib } void CustomTimerProperties::AppendPropertiesToHTSPMessage( - const std::vector& props, htsmsg_t* msg) const + const std::vector& props, htsmsg_t* msg) const { for (const auto& prop : props) { @@ -230,7 +230,7 @@ void CustomTimerProperties::AppendPropertiesToHTSPMessage( case CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE: { /* Broadcast type */ - htsmsg_add_u32(msg, "broadcastType", prop.GetValue()); + htsmsg_add_u32(msg, "broadcastType", prop.GetIntValue()); break; } case CUSTOM_PROP_ID_DVR_CONFIGURATION: @@ -238,7 +238,7 @@ void CustomTimerProperties::AppendPropertiesToHTSPMessage( /* DVR configuration */ for (const auto& config : m_dvrConfigs) { - if (config.GetId() == prop.GetValue()) + if (config.GetId() == prop.GetIntValue()) { htsmsg_add_str(msg, "configName", config.GetUuid().c_str()); break; @@ -266,18 +266,22 @@ int CustomTimerProperties::GetDvrConfigurationId(const std::string& uuid) const return -1; } -kodi::addon::PVRIntSettingDefinition CustomTimerProperties::CreateSettingDefinition( +kodi::addon::PVRSettingDefinition CustomTimerProperties::CreateSettingDefinition( unsigned int settingId, int resourceId, const std::vector& values, int defaultValue, uint64_t readonlyConditions) const { - kodi::addon::PVRIntSettingDefinition settingDef; + kodi::addon::PVRSettingDefinition settingDef; settingDef.SetId(settingId); settingDef.SetName(kodi::addon::GetLocalizedString(resourceId)); - settingDef.SetValues(std::move(values)); - settingDef.SetDefaultValue(defaultValue); settingDef.SetReadonlyConditions(readonlyConditions); + + kodi::addon::PVRIntSettingDefinition intSettingDef; + intSettingDef.SetValues(std::move(values)); + intSettingDef.SetDefaultValue(defaultValue); + + settingDef.SetIntDefinition(intSettingDef); return settingDef; } diff --git a/src/tvheadend/CustomTimerProperties.h b/src/tvheadend/CustomTimerProperties.h index 5e7db26c..2266cdb3 100644 --- a/src/tvheadend/CustomTimerProperties.h +++ b/src/tvheadend/CustomTimerProperties.h @@ -18,9 +18,9 @@ extern "C" namespace kodi::addon { -class PVRIntKeyValuePair; +class PVRSettingDefinition; +class PVRSettingKeyValuePair; class PVRTypeIntValue; -class PVRIntSettingDefinition; } // namespace kodi::addon namespace tvheadend @@ -47,28 +47,28 @@ class CustomTimerProperties virtual ~CustomTimerProperties() = default; // Custom props for all one-shot timers - std::vector GetProperties( + std::vector GetProperties( const tvheadend::entity::Recording& rec) const; // Custom props for Autorecs - std::vector GetProperties( + std::vector GetProperties( const tvheadend::entity::AutoRecording& autorec) const; // Custom props for Timerecs - std::vector GetProperties( + std::vector GetProperties( const tvheadend::entity::TimeRecording& timerec) const; // Setting definitions - const std::vector GetSettingDefinitions() const; + const std::vector GetSettingDefinitions() const; // Append given props to given HTSP message - void AppendPropertiesToHTSPMessage(const std::vector& props, + void AppendPropertiesToHTSPMessage(const std::vector& props, htsmsg_t* msg) const; private: const std::vector GetPossibleValues(unsigned int propId, int& defaultValue) const; - kodi::addon::PVRIntSettingDefinition CreateSettingDefinition( + kodi::addon::PVRSettingDefinition CreateSettingDefinition( unsigned int settingId, int resourceId, const std::vector& values, diff --git a/src/tvheadend/TimeRecordings.cpp b/src/tvheadend/TimeRecordings.cpp index 25cbc191..7009f3bb 100644 --- a/src/tvheadend/TimeRecordings.cpp +++ b/src/tvheadend/TimeRecordings.cpp @@ -83,8 +83,8 @@ void TimeRecordings::GetTimerecTimers(std::vector& timers tmr.SetFullTextEpgSearch(false); // n/a for manual timers tmr.SetParentClientIndex(0); - /* Custom integer props. */ - tmr.SetCustomIntProperties(m_customTimerProps.GetProperties(rec.second)); + /* Custom props. */ + tmr.SetCustomProperties(m_customTimerProps.GetProperties(rec.second)); timers.emplace_back(std::move(tmr)); } @@ -114,8 +114,8 @@ const std::string TimeRecordings::GetTimerStringIdFromIntId(unsigned int intId) return ""; } -const std::vector TimeRecordings:: - GetCustomIntSettingDefinitions() const +const std::vector TimeRecordings::GetCustomSettingDefinitions() + const { return m_customTimerProps.GetSettingDefinitions(); } @@ -175,8 +175,8 @@ PVR_ERROR TimeRecordings::SendTimerecAddOrUpdate(const kodi::addon::PVRTimer& ti if (timer.GetDirectory() != "/") htsmsg_add_str(m, "directory", timer.GetDirectory().c_str()); - /* Custom integer props. */ - m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomIntProperties(), m); + /* Custom props. */ + m_customTimerProps.AppendPropertiesToHTSPMessage(timer.GetCustomProperties(), m); /* Send and Wait */ { diff --git a/src/tvheadend/TimeRecordings.h b/src/tvheadend/TimeRecordings.h index b32c159d..8248385c 100644 --- a/src/tvheadend/TimeRecordings.h +++ b/src/tvheadend/TimeRecordings.h @@ -41,7 +41,7 @@ class TimeRecordings int GetTimerecTimerCount() const; void GetTimerecTimers(std::vector& timers); const unsigned int GetTimerIntIdFromStringId(const std::string& strId) const; - const std::vector GetCustomIntSettingDefinitions() const; + const std::vector GetCustomSettingDefinitions() const; /* client to server messages */ PVR_ERROR SendTimerecAdd(const kodi::addon::PVRTimer& timer);