diff --git a/pvr.hts/addon.xml.in b/pvr.hts/addon.xml.in index 9dd1cba7..0044851f 100644 --- a/pvr.hts/addon.xml.in +++ b/pvr.hts/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.hts/changelog.txt b/pvr.hts/changelog.txt index 993b12f1..ee442579 100644 --- a/pvr.hts/changelog.txt +++ b/pvr.hts/changelog.txt @@ -1,3 +1,6 @@ +v20.6.0 +- Drop support for Tvheadend < 4.2.0 + v20.5.0 - Kodi inputstream API update to version 3.2.0 - Kodi PVR API update to version 8.0.2 diff --git a/pvr.hts/resources/instance-settings.xml b/pvr.hts/resources/instance-settings.xml index 61b7b36b..b73cfa34 100644 --- a/pvr.hts/resources/instance-settings.xml +++ b/pvr.hts/resources/instance-settings.xml @@ -228,8 +228,8 @@ - - + + diff --git a/pvr.hts/resources/language/resource.language.en_gb/strings.po b/pvr.hts/resources/language/resource.language.en_gb/strings.po index 3c2fbce1..58d2e31b 100644 --- a/pvr.hts/resources/language/resource.language.en_gb/strings.po +++ b/pvr.hts/resources/language/resource.language.en_gb/strings.po @@ -294,17 +294,7 @@ msgctxt "#30372" msgid "Record if unique episode according EPG/XMLTV" msgstr "" -#. Recording lifetime representation -#: src/Tvheadend.cpp -msgctxt "#30373" -msgid "Until space needed" -msgstr "" - -#. Recording lifetime representation -#: src/Tvheadend.cpp -msgctxt "#30374" -msgid "Forever" -msgstr "" +#empty strings from id 30373 to 30374 #. Recording lifetime representation #: src/Tvheadend.cpp @@ -384,14 +374,14 @@ msgctxt "#30387" msgid "3 years" msgstr "" -#. Recording lifetime representation (for setting dialog only) +#. Recording lifetime representation msgctxt "#30388" -msgid "Until space needed (tvh 4.1+)" +msgid "Until space needed" msgstr "" -#. Recording lifetime representation (for setting dialog only) +#. Recording lifetime representation msgctxt "#30389" -msgid "Forever (tvh 4.1+)" +msgid "Forever" msgstr "" #. Recording lifetime representation diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp index 8c4191fe..ea8e9e3b 100644 --- a/src/Tvheadend.cpp +++ b/src/Tvheadend.cpp @@ -705,12 +705,7 @@ PVR_ERROR CTvheadend::SetRecordingLifetime(const kodi::addon::PVRRecording& rec) /* Build message */ htsmsg_t* m = htsmsg_create_map(); htsmsg_add_u32(m, "id", std::stoul(rec.GetRecordingId())); - - if (m_conn->GetProtocol() >= 25) - htsmsg_add_u32(m, "removal", LifetimeMapper::KodiToTvh(rec.GetLifetime())); // remove from disk - else - htsmsg_add_u32(m, "retention", - LifetimeMapper::KodiToTvh(rec.GetLifetime())); // remove from tvh database + htsmsg_add_u32(m, "removal", LifetimeMapper::KodiToTvh(rec.GetLifetime())); // remove from disk return SendDvrUpdate(m); } @@ -809,15 +804,9 @@ void CTvheadend::GetLivetimeValues(std::vector& li {LifetimeMapper::TvhToKodi(DVR_RET_1YEAR), kodi::addon::GetLocalizedString(30385)}, {LifetimeMapper::TvhToKodi(DVR_RET_2YEARS), kodi::addon::GetLocalizedString(30386)}, {LifetimeMapper::TvhToKodi(DVR_RET_3YEARS), kodi::addon::GetLocalizedString(30387)}, + {LifetimeMapper::TvhToKodi(DVR_RET_SPACE), kodi::addon::GetLocalizedString(30388)}, + {LifetimeMapper::TvhToKodi(DVR_RET_FOREVER), kodi::addon::GetLocalizedString(30389)}, }; - - if (m_conn->GetProtocol() >= 25) - { - lifetimeValues.emplace_back(LifetimeMapper::TvhToKodi(DVR_RET_SPACE), - kodi::addon::GetLocalizedString(30373)); - lifetimeValues.emplace_back(LifetimeMapper::TvhToKodi(DVR_RET_FOREVER), - kodi::addon::GetLocalizedString(30374)); - } } PVR_ERROR CTvheadend::GetTimerTypes(std::vector& types) @@ -852,29 +841,23 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type kodi::addon::GetLocalizedString(30360)); deDupValues.emplace_back(DVR_AUTOREC_RECORD_ONCE_PER_DAY, kodi::addon::GetLocalizedString(30361)); - if (m_conn->GetProtocol() >= 26) - { - deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_EPISODE_NUMBER, - kodi::addon::GetLocalizedString(30362)); - deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_SUBTITLE, - kodi::addon::GetLocalizedString(30363)); - deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_TITLE, - kodi::addon::GetLocalizedString(30364)); - deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_DESCRIPTION, - kodi::addon::GetLocalizedString(30365)); - } + deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_EPISODE_NUMBER, + kodi::addon::GetLocalizedString(30362)); + deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_SUBTITLE, + kodi::addon::GetLocalizedString(30363)); + deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_TITLE, + kodi::addon::GetLocalizedString(30364)); + deDupValues.emplace_back(DVR_AUTOREC_LRECORD_DIFFERENT_DESCRIPTION, + kodi::addon::GetLocalizedString(30365)); if (m_conn->GetProtocol() >= 27) deDupValues.emplace_back(DVR_AUTOREC_LRECORD_ONCE_PER_MONTH, kodi::addon::GetLocalizedString(30371)); - if (m_conn->GetProtocol() >= 26) - { - deDupValues.emplace_back(DVR_AUTOREC_LRECORD_ONCE_PER_WEEK, - kodi::addon::GetLocalizedString(30366)); - deDupValues.emplace_back(DVR_AUTOREC_LRECORD_ONCE_PER_DAY, - kodi::addon::GetLocalizedString(30367)); - } + deDupValues.emplace_back(DVR_AUTOREC_LRECORD_ONCE_PER_WEEK, + kodi::addon::GetLocalizedString(30366)); + deDupValues.emplace_back(DVR_AUTOREC_LRECORD_ONCE_PER_DAY, + kodi::addon::GetLocalizedString(30367)); if (m_conn->GetProtocol() >= 31) deDupValues.emplace_back(DVR_AUTOREC_RECORD_UNIQUE, kodi::addon::GetLocalizedString(30372)); @@ -886,19 +869,14 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type unsigned int TIMER_ONCE_MANUAL_ATTRIBS = PVR_TIMER_TYPE_IS_MANUAL | PVR_TIMER_TYPE_SUPPORTS_CHANNELS | PVR_TIMER_TYPE_SUPPORTS_START_TIME | PVR_TIMER_TYPE_SUPPORTS_END_TIME | - PVR_TIMER_TYPE_SUPPORTS_PRIORITY | PVR_TIMER_TYPE_SUPPORTS_LIFETIME; + PVR_TIMER_TYPE_SUPPORTS_PRIORITY | PVR_TIMER_TYPE_SUPPORTS_LIFETIME | + PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE; unsigned int TIMER_ONCE_EPG_ATTRIBS = PVR_TIMER_TYPE_SUPPORTS_CHANNELS | PVR_TIMER_TYPE_SUPPORTS_START_TIME | PVR_TIMER_TYPE_SUPPORTS_END_TIME | PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE | PVR_TIMER_TYPE_SUPPORTS_START_END_MARGIN | PVR_TIMER_TYPE_SUPPORTS_PRIORITY | - PVR_TIMER_TYPE_SUPPORTS_LIFETIME; - - if (m_conn->GetProtocol() >= 23) - { - TIMER_ONCE_MANUAL_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE; - TIMER_ONCE_EPG_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE; - } + PVR_TIMER_TYPE_SUPPORTS_LIFETIME | PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE; /* Timer types definition. */ @@ -1020,13 +998,8 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type PVR_TIMER_TYPE_SUPPORTS_START_TIME | PVR_TIMER_TYPE_SUPPORTS_START_ANYTIME | PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS | PVR_TIMER_TYPE_SUPPORTS_START_END_MARGIN | PVR_TIMER_TYPE_SUPPORTS_PRIORITY | PVR_TIMER_TYPE_SUPPORTS_LIFETIME | - PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS | PVR_TIMER_TYPE_SUPPORTS_ANY_CHANNEL; - - if (m_conn->GetProtocol() >= 20) - { - TIMER_REPEATING_EPG_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH; - TIMER_REPEATING_EPG_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_RECORD_ONLY_NEW_EPISODES; - } + PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS | PVR_TIMER_TYPE_SUPPORTS_ANY_CHANNEL | + PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH | PVR_TIMER_TYPE_SUPPORTS_RECORD_ONLY_NEW_EPISODES; if (!m_settings->GetAutorecApproxTime()) { @@ -1084,12 +1057,7 @@ bool CTvheadend::CreateTimer(const Recording& tvhTmr, kodi::addon::PVRTimer& tmr tmr.SetEPGSearchString(""); // n/a for one-shot timers tmr.SetDirectory(""); // n/a for one-shot timers tmr.SetSummary(tvhTmr.GetDescription()); - - if (m_conn->GetProtocol() >= 23) - tmr.SetState(!tvhTmr.IsEnabled() ? PVR_TIMER_STATE_DISABLED : tvhTmr.GetState()); - else - tmr.SetState(tvhTmr.GetState()); - + tmr.SetState(!tvhTmr.IsEnabled() ? PVR_TIMER_STATE_DISABLED : tvhTmr.GetState()); tmr.SetPriority(tvhTmr.GetPriority()); tmr.SetLifetime(tvhTmr.GetLifetime()); tmr.SetTimerType(tvhTmr.GetTimerType()); @@ -1185,19 +1153,11 @@ PVR_ERROR CTvheadend::AddTimer(const kodi::addon::PVRTimer& timer) htsmsg_add_str(m, "description", timer.GetSummary().c_str()); } - if (m_conn->GetProtocol() >= 23) - htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); - + htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); htsmsg_add_s64(m, "startExtra", timer.GetMarginStart()); htsmsg_add_s64(m, "stopExtra", timer.GetMarginEnd()); - - if (m_conn->GetProtocol() >= 25) - htsmsg_add_u32(m, "removal", - LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from disk - else - htsmsg_add_u32(m, "retention", - LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from tvh database - + htsmsg_add_u32(m, "removal", + LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from disk htsmsg_add_u32(m, "priority", timer.GetPriority()); /* Send and Wait */ @@ -1247,18 +1207,8 @@ PVR_ERROR CTvheadend::DeleteTimer(const kodi::addon::PVRTimer& timer, bool) const auto& it = m_recordings.find(timer.GetClientIndex()); if (it != m_recordings.end() && it->second.IsRecording()) { - // This is a request to stop an active recording. - if (m_conn->GetProtocol() >= 26) - { - // gracefully stop the recording (mark as success in tvh) - return SendDvrDelete(timer.GetClientIndex(), "stopDvrEntry"); - } - else - { - // abort the recording (mark as failure in tvh) - no other choice, - // because graceful stop HTSP method was not available before HTSP v26. - return SendDvrDelete(timer.GetClientIndex(), "cancelDvrEntry"); - } + // gracefully stop the recording (mark as success in tvh) + return SendDvrDelete(timer.GetClientIndex(), "stopDvrEntry"); } } @@ -1302,36 +1252,9 @@ PVR_ERROR CTvheadend::UpdateTimer(const kodi::addon::PVRTimer& timer) /* Build message */ htsmsg_t* m = htsmsg_create_map(); htsmsg_add_u32(m, "id", timer.GetClientIndex()); - - if (m_conn->GetProtocol() >= 22) - { - /* support for updating the channel was added very late to the htsp protocol. */ - htsmsg_add_u32(m, "channelId", timer.GetClientChannelUid()); - } - else - { - std::lock_guard lock(m_mutex); - - const auto& it = m_recordings.find(timer.GetClientIndex()); - if (it == m_recordings.end()) - { - Logger::Log(LogLevel::LEVEL_ERROR, "cannot find the timer to update"); - return PVR_ERROR_INVALID_PARAMETERS; - } - - if (it->second.GetChannel() != static_cast(timer.GetClientChannelUid())) - { - Logger::Log(LogLevel::LEVEL_ERROR, - "updating channels of one-shot timers not supported by HTSP v%d", - m_conn->GetProtocol()); - return PVR_ERROR_NOT_IMPLEMENTED; - } - } - + htsmsg_add_u32(m, "channelId", timer.GetClientChannelUid()); htsmsg_add_str(m, "title", timer.GetTitle().c_str()); - - if (m_conn->GetProtocol() >= 23) - htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); + htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); int64_t start = timer.GetStartTime(); if (start == 0) @@ -1345,14 +1268,8 @@ PVR_ERROR CTvheadend::UpdateTimer(const kodi::addon::PVRTimer& timer) htsmsg_add_str(m, "description", timer.GetSummary().c_str()); htsmsg_add_s64(m, "startExtra", timer.GetMarginStart()); htsmsg_add_s64(m, "stopExtra", timer.GetMarginEnd()); - - if (m_conn->GetProtocol() >= 25) - htsmsg_add_u32(m, "removal", - LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from disk - else - htsmsg_add_u32(m, "retention", - LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from tvh database - + htsmsg_add_u32(m, "removal", + LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from disk htsmsg_add_u32(m, "priority", timer.GetPriority()); return SendDvrUpdate(m); @@ -1371,21 +1288,18 @@ PVR_ERROR CTvheadend::UpdateTimer(const kodi::addon::PVRTimer& timer) else if ((timer.GetTimerType() == TIMER_ONCE_CREATED_BY_TIMEREC) || (timer.GetTimerType() == TIMER_ONCE_CREATED_BY_AUTOREC)) { - if (m_conn->GetProtocol() >= 23) - { - /* Read-only timer created by autorec or timerec */ - std::lock_guard lock(m_mutex); + /* Read-only timer created by autorec or timerec */ + std::lock_guard lock(m_mutex); - const auto& it = m_recordings.find(timer.GetClientIndex()); - if (it != m_recordings.end() && - (it->second.IsEnabled() == (timer.GetState() == PVR_TIMER_STATE_DISABLED))) - { - /* This is actually a request to enable/disable a timer. */ - htsmsg_t* m = htsmsg_create_map(); - htsmsg_add_u32(m, "id", timer.GetClientIndex()); - htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); - return SendDvrUpdate(m); - } + const auto& it = m_recordings.find(timer.GetClientIndex()); + if (it != m_recordings.end() && + (it->second.IsEnabled() == (timer.GetState() == PVR_TIMER_STATE_DISABLED))) + { + /* This is actually a request to enable/disable a timer. */ + htsmsg_t* m = htsmsg_create_map(); + htsmsg_add_u32(m, "id", timer.GetClientIndex()); + htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); + return SendDvrUpdate(m); } Logger::Log(LogLevel::LEVEL_ERROR, "timer is read-only"); @@ -2246,22 +2160,8 @@ void CTvheadend::ParseChannelAddOrUpdate(htsmsg_t* msg, bool bAdd) continue; /* Channel type */ - if (m_conn->GetProtocol() >= 26) - { - if (!htsmsg_get_u32(&f->hmf_msg, "content", &u32)) - channel.SetType(u32); - } - else - { - str = htsmsg_get_str(&f->hmf_msg, "type"); - if (str) - { - if (!std::strcmp(str, "Radio")) - channel.SetType(CHANNEL_TYPE_RADIO); - else if (!std::strcmp(str, "SDTV") || !std::strcmp(str, "HDTV")) - channel.SetType(CHANNEL_TYPE_TV); - } - } + if (!htsmsg_get_u32(&f->hmf_msg, "content", &u32)) + channel.SetType(u32); /* CAID */ if (caid == 0) @@ -2398,7 +2298,7 @@ void CTvheadend::ParseRecordingAddOrUpdate(htsmsg_t* msg, bool bAdd) htsmsg_t* files = htsmsg_get_list(msg, "files"); if (files) { - bool needChannelType = !rec.GetChannelType() && m_conn->GetProtocol() >= 25; + bool needChannelType = !rec.GetChannelType(); bool hasAudio = false; bool hasVideo = false; @@ -2465,7 +2365,7 @@ void CTvheadend::ParseRecordingAddOrUpdate(htsmsg_t* msg, bool bAdd) } /* Channel name fallback (in case channel was deleted) */ - if (rec.GetChannelName().empty() && m_conn->GetProtocol() >= 25) + if (rec.GetChannelName().empty()) { const char* str = htsmsg_get_str(msg, "channelName"); if (str) @@ -2490,31 +2390,15 @@ void CTvheadend::ParseRecordingAddOrUpdate(htsmsg_t* msg, bool bAdd) return; } - if (m_conn->GetProtocol() >= 25) + uint32_t removal = 0; + if (!htsmsg_get_u32(msg, "removal", &removal)) { - uint32_t removal = 0; - if (!htsmsg_get_u32(msg, "removal", &removal)) - { - rec.SetLifetime(removal); - } - else if (bAdd) - { - Logger::Log(LogLevel::LEVEL_ERROR, "malformed dvrEntryAdd: 'removal' missing"); - return; - } + rec.SetLifetime(removal); } - else + else if (bAdd) { - uint32_t retention = 0; - if (!htsmsg_get_u32(msg, "retention", &retention)) - { - rec.SetLifetime(retention); - } - else if (bAdd) - { - Logger::Log(LogLevel::LEVEL_ERROR, "malformed dvrEntryAdd: 'retention' missing"); - return; - } + Logger::Log(LogLevel::LEVEL_ERROR, "malformed dvrEntryAdd: 'removal' missing"); + return; } uint32_t priority = 0; diff --git a/src/tvheadend/AutoRecordings.cpp b/src/tvheadend/AutoRecordings.cpp index 32f61fe1..84543c31 100644 --- a/src/tvheadend/AutoRecordings.cpp +++ b/src/tvheadend/AutoRecordings.cpp @@ -92,12 +92,7 @@ void AutoRecordings::GetAutorecTimers(std::vector& timers tmr.SetLifetime(rec.second.GetLifetime()); tmr.SetMaxRecordings(0); // not supported by tvh tmr.SetRecordingGroup(0); // not supported by tvh - - if (m_conn.GetProtocol() >= 20) - tmr.SetPreventDuplicateEpisodes(rec.second.GetDupDetect()); - else - tmr.SetPreventDuplicateEpisodes(0); // not supported by tvh - + tmr.SetPreventDuplicateEpisodes(rec.second.GetDupDetect()); tmr.SetFirstDay(0); // not supported by tvh tmr.SetWeekdays(rec.second.GetDaysOfWeek()); tmr.SetEPGUid(PVR_TIMER_NO_EPG_UID); // n/a for repeating timers @@ -143,16 +138,7 @@ PVR_ERROR AutoRecordings::SendAutorecAdd(const kodi::addon::PVRTimer& timer) PVR_ERROR AutoRecordings::SendAutorecUpdate(const kodi::addon::PVRTimer& timer) { - if (m_conn.GetProtocol() >= 25) - return SendAutorecAddOrUpdate(timer, true); - - /* Note: there is no "updateAutorec" htsp method for htsp version < 25, thus delete + add. */ - PVR_ERROR error = SendAutorecDelete(timer); - - if (error == PVR_ERROR_NO_ERROR) - error = SendAutorecAdd(timer); - - return error; + return SendAutorecAddOrUpdate(timer, true); } PVR_ERROR AutoRecordings::SendAutorecAddOrUpdate(const kodi::addon::PVRTimer& timer, bool update) @@ -190,34 +176,14 @@ PVR_ERROR AutoRecordings::SendAutorecAddOrUpdate(const kodi::addon::PVRTimer& ti /* "title" not empty && !fulltext => match strEpgSearchString against episode title only */ /* "title" not empty && fulltext => match strEpgSearchString against episode title, episode */ /* subtitle, episode summary and episode description (HTSPv19) */ - if (m_conn.GetProtocol() >= 20) - htsmsg_add_u32(m, "fulltext", timer.GetFullTextEpgSearch() ? 1 : 0); + htsmsg_add_u32(m, "fulltext", timer.GetFullTextEpgSearch() ? 1 : 0); htsmsg_add_s64(m, "startExtra", timer.GetMarginStart()); htsmsg_add_s64(m, "stopExtra", timer.GetMarginEnd()); - - if (m_conn.GetProtocol() >= 25) - { - htsmsg_add_u32(m, "removal", timer.GetLifetime()); // remove from disk - htsmsg_add_s64(m, "channelId", - timer.GetClientChannelUid()); // channelId is signed for >= htspv25, -1 = any - } - else - { - htsmsg_add_u32(m, "retention", - LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from tvh database - - if (timer.GetClientChannelUid() >= 0) - htsmsg_add_u32( - m, "channelId", - timer.GetClientChannelUid()); // channelId is unsigned for < htspv25, not sending = any - } - + htsmsg_add_u32(m, "removal", timer.GetLifetime()); // remove from disk + htsmsg_add_s64(m, "channelId", timer.GetClientChannelUid()); // -1 = any htsmsg_add_u32(m, "daysOfWeek", timer.GetWeekdays()); - - if (m_conn.GetProtocol() >= 20) - htsmsg_add_u32(m, "dupDetect", timer.GetPreventDuplicateEpisodes()); - + htsmsg_add_u32(m, "dupDetect", timer.GetPreventDuplicateEpisodes()); htsmsg_add_u32(m, "priority", timer.GetPriority()); htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); @@ -371,29 +337,14 @@ bool AutoRecordings::ParseAutorecAddOrUpdate(htsmsg_t* msg, bool bAdd) return false; } - if (m_conn.GetProtocol() >= 25) + if (!htsmsg_get_u32(msg, "removal", &u32)) { - if (!htsmsg_get_u32(msg, "removal", &u32)) - { - rec.SetLifetime(u32); - } - else if (bAdd) - { - Logger::Log(LogLevel::LEVEL_ERROR, "malformed autorecEntryAdd: 'removal' missing"); - return false; - } + rec.SetLifetime(u32); } - else + else if (bAdd) { - if (!htsmsg_get_u32(msg, "retention", &u32)) - { - rec.SetLifetime(u32); - } - else if (bAdd) - { - Logger::Log(LogLevel::LEVEL_ERROR, "malformed autorecEntryAdd: 'retention' missing"); - return false; - } + Logger::Log(LogLevel::LEVEL_ERROR, "malformed autorecEntryAdd: 'removal' missing"); + return false; } if (!htsmsg_get_u32(msg, "daysOfWeek", &u32)) @@ -462,7 +413,7 @@ bool AutoRecordings::ParseAutorecAddOrUpdate(htsmsg_t* msg, bool bAdd) { rec.SetDupDetect(u32); } - else if (bAdd && (m_conn.GetProtocol() >= 20)) + else if (bAdd) { Logger::Log(LogLevel::LEVEL_ERROR, "malformed autorecEntryAdd: 'dupDetect' missing"); return false; diff --git a/src/tvheadend/HTSPConnection.cpp b/src/tvheadend/HTSPConnection.cpp index 87c2d6b1..76b7d18f 100644 --- a/src/tvheadend/HTSPConnection.cpp +++ b/src/tvheadend/HTSPConnection.cpp @@ -32,9 +32,9 @@ using namespace tvheadend::utilities; #define FAST_RECONNECT_INTERVAL (500) // ms #define SLOW_RECONNECT_INTERVAL (5000) // ms -#define HTSP_MIN_SERVER_VERSION (19) // Server must support at least this htsp version +#define HTSP_MIN_SERVER_VERSION (26) // Server must support at least this htsp version #define HTSP_CLIENT_VERSION \ - (34) // Client uses HTSP features up to this version. If the respective \ + (35) // Client uses HTSP features up to this version. If the respective \ // addon feature requires htsp features introduced after \ // HTSP_MIN_SERVER_VERSION this feature will only be available if the \ // actual server HTSP version matches (runtime htsp version check). diff --git a/src/tvheadend/Subscription.cpp b/src/tvheadend/Subscription.cpp index 5696a21a..d2b2d67e 100644 --- a/src/tvheadend/Subscription.cpp +++ b/src/tvheadend/Subscription.cpp @@ -240,49 +240,31 @@ void Subscription::ParseSubscriptionStatus(htsmsg_t* m) } const char* status = htsmsg_get_str(m, "status"); + const char* error = htsmsg_get_str(m, "subscriptionError"); - /* 'subscriptionErrors' was added in htsp v20, use 'status' for older backends */ - if (m_conn.GetProtocol() >= 20) + /* This field is absent when everything is fine */ + if (error) { - const char* error = htsmsg_get_str(m, "subscriptionError"); - - /* This field is absent when everything is fine */ - if (error) - { - if (!std::strcmp("badSignal", error)) - SetState(SUBSCRIPTION_NOSIGNAL); - else if (!std::strcmp("scrambled", error)) - SetState(SUBSCRIPTION_SCRAMBLED); - else if (!std::strcmp("userLimit", error)) - SetState(SUBSCRIPTION_USERLIMIT); - else if (!std::strcmp("noFreeAdapter", error)) - SetState(SUBSCRIPTION_NOFREEADAPTER); - else if (!std::strcmp("tuningFailed", error)) - SetState(SUBSCRIPTION_TUNINGFAILED); - else if (!std::strcmp("userAccess", error)) - SetState(SUBSCRIPTION_NOACCESS); - else - SetState(SUBSCRIPTION_UNKNOWN); - - /* Show an OSD message */ - ShowStateNotification(); - } + if (!std::strcmp("badSignal", error)) + SetState(SUBSCRIPTION_NOSIGNAL); + else if (!std::strcmp("scrambled", error)) + SetState(SUBSCRIPTION_SCRAMBLED); + else if (!std::strcmp("userLimit", error)) + SetState(SUBSCRIPTION_USERLIMIT); + else if (!std::strcmp("noFreeAdapter", error)) + SetState(SUBSCRIPTION_NOFREEADAPTER); + else if (!std::strcmp("tuningFailed", error)) + SetState(SUBSCRIPTION_TUNINGFAILED); + else if (!std::strcmp("userAccess", error)) + SetState(SUBSCRIPTION_NOACCESS); else - SetState(SUBSCRIPTION_RUNNING); - } - else - { - /* This field is absent when everything is fine */ - if (status) - { SetState(SUBSCRIPTION_UNKNOWN); - /* Show an OSD message */ - kodi::QueueNotification(QUEUE_INFO, "", status); - } - else - SetState(SUBSCRIPTION_RUNNING); + /* Show an OSD message */ + ShowStateNotification(); } + else + SetState(SUBSCRIPTION_RUNNING); } void Subscription::ShowStateNotification() diff --git a/src/tvheadend/TimeRecordings.cpp b/src/tvheadend/TimeRecordings.cpp index e334627a..16a13cd6 100644 --- a/src/tvheadend/TimeRecordings.cpp +++ b/src/tvheadend/TimeRecordings.cpp @@ -114,16 +114,7 @@ PVR_ERROR TimeRecordings::SendTimerecAdd(const kodi::addon::PVRTimer& timer) PVR_ERROR TimeRecordings::SendTimerecUpdate(const kodi::addon::PVRTimer& timer) { - if (m_conn.GetProtocol() >= 25) - return SendTimerecAddOrUpdate(timer, true); - - /* Note: there is no "updateTimerec" htsp method for htsp version < 25, thus delete + add. */ - PVR_ERROR error = SendTimerecDelete(timer); - - if (error == PVR_ERROR_NO_ERROR) - error = SendTimerecAdd(timer); - - return error; + return SendTimerecAddOrUpdate(timer, true); } PVR_ERROR TimeRecordings::SendTimerecAddOrUpdate(const kodi::addon::PVRTimer& timer, bool update) @@ -159,21 +150,8 @@ PVR_ERROR TimeRecordings::SendTimerecAddOrUpdate(const kodi::addon::PVRTimer& ti struct tm* tm_stop = std::localtime(&endTime); htsmsg_add_u32(m, "stop", tm_stop->tm_hour * 60 + tm_stop->tm_min); // end time in minutes from midnight - - if (m_conn.GetProtocol() >= 25) - { - htsmsg_add_u32(m, "removal", timer.GetLifetime()); // remove from disk - htsmsg_add_s64(m, "channelId", - timer.GetClientChannelUid()); // channelId is signed for >= htspv25 - } - else - { - htsmsg_add_u32(m, "retention", - LifetimeMapper::KodiToTvh(timer.GetLifetime())); // remove from tvh database - htsmsg_add_u32(m, "channelId", - timer.GetClientChannelUid()); // channelId is unsigned for < htspv25 - } - + htsmsg_add_u32(m, "removal", timer.GetLifetime()); // remove from disk + htsmsg_add_s64(m, "channelId", timer.GetClientChannelUid()); htsmsg_add_u32(m, "daysOfWeek", timer.GetWeekdays()); htsmsg_add_u32(m, "priority", timer.GetPriority()); htsmsg_add_u32(m, "enabled", timer.GetState() == PVR_TIMER_STATE_DISABLED ? 0 : 1); @@ -273,29 +251,14 @@ bool TimeRecordings::ParseTimerecAddOrUpdate(htsmsg_t* msg, bool bAdd) return false; } - if (m_conn.GetProtocol() >= 25) + if (!htsmsg_get_u32(msg, "removal", &u32)) { - if (!htsmsg_get_u32(msg, "removal", &u32)) - { - rec.SetLifetime(u32); - } - else if (bAdd) - { - Logger::Log(LogLevel::LEVEL_ERROR, "malformed timerecEntryAdd: 'removal' missing"); - return false; - } + rec.SetLifetime(u32); } - else + else if (bAdd) { - if (!htsmsg_get_u32(msg, "retention", &u32)) - { - rec.SetLifetime(u32); - } - else if (bAdd) - { - Logger::Log(LogLevel::LEVEL_ERROR, "malformed timerecEntryAdd: 'retention' missing"); - return false; - } + Logger::Log(LogLevel::LEVEL_ERROR, "malformed timerecEntryAdd: 'removal' missing"); + return false; } if (!htsmsg_get_u32(msg, "priority", &u32))