diff --git a/pvr.hts/addon.xml.in b/pvr.hts/addon.xml.in index 40f1e04f..fe75471b 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 f6aaf04f..f1d3842f 100644 --- a/pvr.hts/changelog.txt +++ b/pvr.hts/changelog.txt @@ -1,3 +1,6 @@ +v22.6.0 +- Add support for Autorec properties "Start after" and "Start before" + v22.5.0 - PVR Add-on API v9.2.0 - Add support for multiple recorded streams at a time (used by Kodi for thumbnail extraction) diff --git a/pvr.hts/resources/instance-settings.xml b/pvr.hts/resources/instance-settings.xml index 68159c5c..5e954211 100644 --- a/pvr.hts/resources/instance-settings.xml +++ b/pvr.hts/resources/instance-settings.xml @@ -166,30 +166,6 @@ - - 0 - 0 - - - - - - - - - - 0 - 15 - - 0 - 5 - 120 - - - 1 - - - 0 false 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 a2face4a..2c0ee386 100644 --- a/pvr.hts/resources/language/resource.language.en_gb/strings.po +++ b/pvr.hts/resources/language/resource.language.en_gb/strings.po @@ -88,22 +88,6 @@ msgctxt "#30050" msgid "Auto recordings" msgstr "" -msgctxt "#30051" -msgid "Start time window calculation" -msgstr "" - -msgctxt "#30052" -msgid "Strict (start time + end time)" -msgstr "" - -msgctxt "#30053" -msgid "Relaxed (start time +/- margin)" -msgstr "" - -msgctxt "#30054" -msgid "Maximum start time margin (minutes)" -msgstr "" - msgctxt "#30055" msgid "Default priority" msgstr "" @@ -516,3 +500,11 @@ msgstr "" msgctxt "#30605" msgid "(Default profile)" msgstr "" + +msgctxt "#30606" +msgid "Start after" +msgstr "" + +msgctxt "#30607" +msgid "Start before" +msgstr "" diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp index 6f648f76..931a881d 100644 --- a/src/Tvheadend.cpp +++ b/src/Tvheadend.cpp @@ -1113,19 +1113,11 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type { unsigned int TIMER_REPEATING_SERIESLINK_ATTRIBS = PVR_TIMER_TYPE_IS_REPEATING | PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE | - PVR_TIMER_TYPE_SUPPORTS_CHANNELS | PVR_TIMER_TYPE_SUPPORTS_START_TIME | - PVR_TIMER_TYPE_SUPPORTS_START_ANYTIME | PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS | + PVR_TIMER_TYPE_SUPPORTS_CHANNELS | 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 | PVR_TIMER_TYPE_REQUIRES_EPG_SERIESLINK_ON_CREATE; - if (!m_settings->GetAutorecApproxTime()) - { - /* We need the end time to represent the end of the tvh starting window */ - TIMER_REPEATING_SERIESLINK_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_END_TIME; - TIMER_REPEATING_SERIESLINK_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_END_ANYTIME; - } - /* Repeating epg based - series link autorec */ types.emplace_back(TimerType( /* Settings */ @@ -1147,19 +1139,11 @@ PVR_ERROR CTvheadend::GetTimerTypes(std::vector& type unsigned int TIMER_REPEATING_EPG_ATTRIBS = PVR_TIMER_TYPE_IS_REPEATING | PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE | PVR_TIMER_TYPE_SUPPORTS_TITLE_EPG_MATCH | PVR_TIMER_TYPE_SUPPORTS_CHANNELS | - 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 | PVR_TIMER_TYPE_SUPPORTS_FULLTEXT_EPG_MATCH | PVR_TIMER_TYPE_SUPPORTS_RECORD_ONLY_NEW_EPISODES; - if (!m_settings->GetAutorecApproxTime()) - { - /* We need the end time to represent the end of the tvh starting window */ - TIMER_REPEATING_EPG_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_END_TIME; - TIMER_REPEATING_EPG_ATTRIBS |= PVR_TIMER_TYPE_SUPPORTS_END_ANYTIME; - } - /* Repeating epg based - autorec */ types.emplace_back(TimerType( /* Settings */ diff --git a/src/tvheadend/AutoRecordings.cpp b/src/tvheadend/AutoRecordings.cpp index 3af42147..381c0ed8 100644 --- a/src/tvheadend/AutoRecordings.cpp +++ b/src/tvheadend/AutoRecordings.cpp @@ -28,7 +28,8 @@ AutoRecordings::AutoRecordings(const std::shared_ptr& settings Profiles& dvrConfigs) : m_settings(settings), m_conn(conn), - m_customTimerProps({CUSTOM_PROP_ID_DVR_CONFIGURATION, CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE, + m_customTimerProps({CUSTOM_PROP_ID_AUTOREC_START, CUSTOM_PROP_ID_AUTOREC_STARTWINDOW, + CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE, CUSTOM_PROP_ID_DVR_CONFIGURATION, CUSTOM_PROP_ID_DVR_COMMENT}, conn, dvrConfigs) @@ -69,23 +70,6 @@ void AutoRecordings::GetAutorecTimers(std::vector& timers tmr.SetClientIndex(rec.second.GetId()); tmr.SetClientChannelUid((rec.second.GetChannel() > 0) ? rec.second.GetChannel() : PVR_TIMER_ANY_CHANNEL); - tmr.SetStartTime(rec.second.GetStart()); - tmr.SetEndTime(rec.second.GetStop()); - if (tmr.GetStartTime() == 0) - tmr.SetStartAnyTime(true); - if (tmr.GetEndTime() == 0) - tmr.SetEndAnyTime(true); - - if (!tmr.GetStartAnyTime() && tmr.GetEndAnyTime()) - tmr.SetEndTime(tmr.GetStartTime() + 60 * 60); // Nominal 1 hour duration - if (tmr.GetStartAnyTime() && !tmr.GetEndAnyTime()) - tmr.SetStartTime(tmr.GetEndTime() - 60 * 60); // Nominal 1 hour duration - if (tmr.GetStartAnyTime() && tmr.GetEndAnyTime()) - { - tmr.SetStartTime(std::time(nullptr)); // now - tmr.SetEndTime(tmr.GetStartTime() + 60 * 60); // Nominal 1 hour duration - } - if (rec.second.GetName().empty()) // timers created on backend may not contain a name tmr.SetTitle(rec.second.GetTitle()); else @@ -211,66 +195,6 @@ PVR_ERROR AutoRecordings::SendAutorecAddOrUpdate(const kodi::addon::PVRTimer& ti if (timer.GetDirectory() != "/") htsmsg_add_str(m, "directory", timer.GetDirectory().c_str()); - - /* bAutorecApproxTime enabled: => start time in kodi = approximate start time in tvh */ - /* => 'approximate' = starting window / 2 */ - /* */ - /* bAutorecApproxTime disabled: => start time in kodi = begin of starting window in tvh */ - /* => end time in kodi = end of starting window in tvh */ - if (m_settings->GetAutorecApproxTime()) - { - /* Not sending causes server to set start and startWindow to any time */ - if (timer.GetStartTime() > 0 && !timer.GetStartAnyTime()) - { - time_t startTime = timer.GetStartTime(); - struct tm* tm_start = std::localtime(&startTime); - int32_t startWindowBegin = - tm_start->tm_hour * 60 + tm_start->tm_min - m_settings->GetAutorecMaxDiff(); - int32_t startWindowEnd = - tm_start->tm_hour * 60 + tm_start->tm_min + m_settings->GetAutorecMaxDiff(); - - /* Past midnight correction */ - if (startWindowBegin < 0) - startWindowBegin += (24 * 60); - if (startWindowEnd > (24 * 60)) - startWindowEnd -= (24 * 60); - - htsmsg_add_s32(m, "start", startWindowBegin); - htsmsg_add_s32(m, "startWindow", startWindowEnd); - } - else - { - htsmsg_add_s32(m, "start", -1); - htsmsg_add_s32(m, "startWindow", -1); - } - } - else - { - if (timer.GetStartTime() > 0 && !timer.GetStartAnyTime()) - { - /* Exact start time (minutes from midnight). */ - time_t startTime = timer.GetStartTime(); - struct tm* tm_start = std::localtime(&startTime); - htsmsg_add_s32(m, "start", tm_start->tm_hour * 60 + tm_start->tm_min); - } - else - htsmsg_add_s32( - m, "start", - 25 * 60); // -1 or not sending causes server to set start and startWindow to any time - - if (timer.GetEndTime() > 0 && !timer.GetEndAnyTime()) - { - /* Exact stop time (minutes from midnight). */ - time_t endTime = timer.GetEndTime(); - struct tm* tm_stop = std::localtime(&endTime); - htsmsg_add_s32(m, "startWindow", tm_stop->tm_hour * 60 + tm_stop->tm_min); - } - else - htsmsg_add_s32( - m, "startWindow", - 25 * 60); // -1 or not sending causes server to set start and startWindow to any time - } - /* series link */ if (timer.GetTimerType() == TIMER_REPEATING_SERIESLINK) htsmsg_add_str(m, "serieslinkUri", timer.GetSeriesLink().c_str()); @@ -341,7 +265,6 @@ bool AutoRecordings::ParseAutorecAddOrUpdate(htsmsg_t* msg, bool bAdd) /* Locate/create entry */ AutoRecording& rec = m_autoRecordings[std::string(str)]; - rec.SetSettings(m_settings); rec.SetStringId(std::string(str)); rec.SetDirty(false); diff --git a/src/tvheadend/CustomTimerProperties.cpp b/src/tvheadend/CustomTimerProperties.cpp index ee68e7f9..1c4daba6 100644 --- a/src/tvheadend/CustomTimerProperties.cpp +++ b/src/tvheadend/CustomTimerProperties.cpp @@ -47,6 +47,18 @@ std::vector CustomTimerProperties::GetPrope { switch (propId) { + case CUSTOM_PROP_ID_AUTOREC_START: + { + // Start + customProps.emplace_back(CUSTOM_PROP_ID_AUTOREC_START, autorec.GetStartWindowBegin()); + break; + } + case CUSTOM_PROP_ID_AUTOREC_STARTWINDOW: + { + // Start window + customProps.emplace_back(CUSTOM_PROP_ID_AUTOREC_STARTWINDOW, autorec.GetStartWindowEnd()); + break; + } case CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE: { // Broadcast type @@ -105,6 +117,28 @@ const std::vector CustomTimerProperties::GetS { switch (propId) { + case CUSTOM_PROP_ID_AUTOREC_START: + { + int defaultValue{AUTOREC_START_ANYTIME}; + const std::vector startValues{ + GetPossibleValues(CUSTOM_PROP_ID_AUTOREC_START, defaultValue)}; + ret.emplace_back(CreateSettingDefinition(CUSTOM_PROP_ID_AUTOREC_START, + 30606, // Start after + startValues, defaultValue, + PVR_SETTING_READONLY_CONDITION_NONE)); + break; + } + case CUSTOM_PROP_ID_AUTOREC_STARTWINDOW: + { + int defaultValue{AUTOREC_START_ANYTIME}; + const std::vector startWindowValues{ + GetPossibleValues(CUSTOM_PROP_ID_AUTOREC_STARTWINDOW, defaultValue)}; + ret.emplace_back(CreateSettingDefinition(CUSTOM_PROP_ID_AUTOREC_STARTWINDOW, + 30607, // Start before + startWindowValues, defaultValue, + PVR_SETTING_READONLY_CONDITION_NONE)); + break; + } case CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE: { // Broadcast type @@ -166,6 +200,33 @@ const std::vector CustomTimerProperties::GetPossib { switch (propId) { + case CUSTOM_PROP_ID_AUTOREC_START: + case CUSTOM_PROP_ID_AUTOREC_STARTWINDOW: + { + // Start, Start window + + // Any : AUTOREC_START_ANYTIME (-1) + // 0:00 : 0 + // 0:10 : 0 * 60 + 10 + // ... + // 23:50 : 23 * 60 + 50 + static std::vector startValues{}; + if (startValues.empty()) + { + startValues.reserve(24 * 60 / 10 + 1); + startValues.emplace_back( + kodi::addon::PVRTypeIntValue(AUTOREC_START_ANYTIME, + kodi::addon::GetLocalizedString(30601))); // Any + for (int i = 0; i < 24 * 60; i += 10) + { + const std::string hours{std::to_string(i / 60)}; + const std::string minutes{(i % 60) == 0 ? "00" : std::to_string(i % 60)}; + startValues.emplace_back(kodi::addon::PVRTypeIntValue(i, hours + ":" + minutes)); + } + } + defaultValue = AUTOREC_START_ANYTIME; // Any + return startValues; + } case CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE: { // Broadcast type @@ -241,6 +302,18 @@ void CustomTimerProperties::AppendPropertiesToHTSPMessage( { switch (prop.GetKey()) { + case CUSTOM_PROP_ID_AUTOREC_START: + { + // Start + htsmsg_add_s32(msg, "start", prop.GetIntValue()); + break; + } + case CUSTOM_PROP_ID_AUTOREC_STARTWINDOW: + { + // Start window + htsmsg_add_s32(msg, "startWindow", prop.GetIntValue()); + break; + } case CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE: { // Broadcast type diff --git a/src/tvheadend/CustomTimerProperties.h b/src/tvheadend/CustomTimerProperties.h index ef6bbcc9..df7125be 100644 --- a/src/tvheadend/CustomTimerProperties.h +++ b/src/tvheadend/CustomTimerProperties.h @@ -38,6 +38,8 @@ class RecordingBase; constexpr unsigned int CUSTOM_PROP_ID_AUTOREC_BROADCASTTYPE{1}; constexpr unsigned int CUSTOM_PROP_ID_DVR_CONFIGURATION{2}; constexpr unsigned int CUSTOM_PROP_ID_DVR_COMMENT{3}; +constexpr unsigned int CUSTOM_PROP_ID_AUTOREC_START{4}; +constexpr unsigned int CUSTOM_PROP_ID_AUTOREC_STARTWINDOW{5}; class CustomTimerProperties { diff --git a/src/tvheadend/InstanceSettings.cpp b/src/tvheadend/InstanceSettings.cpp index 300e3620..1887a09d 100644 --- a/src/tvheadend/InstanceSettings.cpp +++ b/src/tvheadend/InstanceSettings.cpp @@ -30,11 +30,7 @@ const bool DEFAULT_ASYNC_EPG = true; const bool DEFAULT_PRETUNER_ENABLED = false; const int DEFAULT_TOTAL_TUNERS = 1; // total tuners > 1 => predictive tuning active const int DEFAULT_PRETUNER_CLOSEDELAY = 10; // secs -const int DEFAULT_AUTOREC_MAXDIFF = - 15; // mins. Maximum difference between real and approximate start time for auto recordings const bool DEFAULT_AUTOREC_USE_REGEX = false; -const int DEFAULT_APPROX_TIME = - 0; // don't use an approximate start time, use a fixed time instead for auto recordings const std::string DEFAULT_STREAMING_PROFILE = ""; const bool DEFAULT_STREAMING_HTTP = false; const int DEFAULT_DVR_PRIO = DVR_PRIO_NORMAL; @@ -62,8 +58,6 @@ InstanceSettings::InstanceSettings(kodi::addon::IAddonInstance& instance) m_bPretunerEnabled(DEFAULT_PRETUNER_ENABLED), m_iTotalTuners(DEFAULT_TOTAL_TUNERS), m_iPreTunerCloseDelay(DEFAULT_PRETUNER_CLOSEDELAY), - m_iAutorecApproxTime(DEFAULT_APPROX_TIME), - m_iAutorecMaxDiff(DEFAULT_AUTOREC_MAXDIFF), m_bAutorecUseRegEx(DEFAULT_AUTOREC_USE_REGEX), m_strStreamingProfile(DEFAULT_STREAMING_PROFILE), m_bUseHTTPStreaming(DEFAULT_STREAMING_HTTP), @@ -103,8 +97,6 @@ void InstanceSettings::ReadSettings() m_bPretunerEnabled ? ReadIntSetting("pretuner_closedelay", DEFAULT_PRETUNER_CLOSEDELAY) : 0); /* Auto recordings */ - SetAutorecApproxTime(ReadIntSetting("autorec_approxtime", DEFAULT_APPROX_TIME)); - SetAutorecMaxDiff(ReadIntSetting("autorec_maxdiff", DEFAULT_AUTOREC_MAXDIFF)); SetAutorecUseRegEx(ReadBoolSetting("autorec_use_regex", DEFAULT_AUTOREC_USE_REGEX)); /* Streaming */ @@ -176,13 +168,6 @@ ADDON_STATUS InstanceSettings::SetSetting(const std::string& key, return ADDON_STATUS_OK; } /* Auto recordings */ - else if (key == "autorec_approxtime") - return SetIntSetting(GetAutorecApproxTime(), value); - else if (key == "autorec_maxdiff") - { - SetAutorecMaxDiff(value.GetInt()); - return ADDON_STATUS_OK; - } else if (key == "autorec_use_regex") { SetAutorecUseRegEx(value.GetBoolean()); diff --git a/src/tvheadend/InstanceSettings.h b/src/tvheadend/InstanceSettings.h index 418931e1..a226908f 100644 --- a/src/tvheadend/InstanceSettings.h +++ b/src/tvheadend/InstanceSettings.h @@ -42,8 +42,6 @@ class InstanceSettings bool GetAsyncEpg() const { return m_bAsyncEpg; } int GetTotalTuners() const { return m_iTotalTuners; } int GetPreTunerCloseDelay() const { return m_iPreTunerCloseDelay; } - int GetAutorecApproxTime() const { return m_iAutorecApproxTime; } - int GetAutorecMaxDiff() const { return m_iAutorecMaxDiff; } bool GetAutorecUseRegEx() const { return m_bAutorecUseRegEx; } std::string GetStreamingProfile() const { return m_strStreamingProfile; } bool GetStreamingHTTP() const { return m_bUseHTTPStreaming; } @@ -79,8 +77,6 @@ class InstanceSettings void SetAsyncEpg(bool value) { m_bAsyncEpg = value; } void SetTotalTuners(int value) { m_iTotalTuners = value; } void SetPreTunerCloseDelay(int value) { m_iPreTunerCloseDelay = value; } - void SetAutorecApproxTime(int value) { m_iAutorecApproxTime = value; } - void SetAutorecMaxDiff(int value) { m_iAutorecMaxDiff = value; } void SetAutorecUseRegEx(bool value) { m_bAutorecUseRegEx = value; } void SetStreamingProfile(const std::string& value) { m_strStreamingProfile = value; } void SetStreamingHTTP(bool value) { m_bUseHTTPStreaming = value; } @@ -120,8 +116,6 @@ class InstanceSettings bool m_bPretunerEnabled; int m_iTotalTuners; int m_iPreTunerCloseDelay; - bool m_iAutorecApproxTime; - int m_iAutorecMaxDiff; bool m_bAutorecUseRegEx; std::string m_strStreamingProfile; bool m_bUseHTTPStreaming; diff --git a/src/tvheadend/entity/AutoRecording.cpp b/src/tvheadend/entity/AutoRecording.cpp index 76530288..b26f8cbf 100644 --- a/src/tvheadend/entity/AutoRecording.cpp +++ b/src/tvheadend/entity/AutoRecording.cpp @@ -7,8 +7,6 @@ #include "AutoRecording.h" -#include "../InstanceSettings.h" - using namespace tvheadend; using namespace tvheadend::entity; @@ -30,37 +28,9 @@ bool AutoRecording::operator!=(const AutoRecording& right) return !(*this == right); } -time_t AutoRecording::GetStart() const +int AutoRecording::GetStartWindowBegin() const { - if (m_settings->GetAutorecApproxTime()) - { - /* Calculate the approximate start time from the starting window */ - if ((m_startWindowBegin == -1) || - (m_startWindowEnd == -1)) // no starting window set => "any time" - { - return 0; - } - else if (m_startWindowEnd < m_startWindowBegin) - { - /* End of start window is a day in the future */ - int32_t newEnd = m_startWindowEnd + (24 * 60); - int32_t newStart = m_startWindowBegin + (newEnd - m_startWindowBegin) / 2; - - if (newStart > (24 * 60)) - newStart -= (24 * 60); - - return LocaltimeToUTC(newStart); - } - else - return LocaltimeToUTC(m_startWindowBegin + (m_startWindowEnd - m_startWindowBegin) / 2); - } - else - { - if (m_startWindowBegin == -1) // "any time" - return 0; - - return LocaltimeToUTC(m_startWindowBegin); - } + return m_startWindowBegin; } void AutoRecording::SetStartWindowBegin(int32_t start) @@ -68,20 +38,9 @@ void AutoRecording::SetStartWindowBegin(int32_t start) m_startWindowBegin = start; } -time_t AutoRecording::GetStop() const +int AutoRecording::GetStartWindowEnd() const { - if (m_settings->GetAutorecApproxTime()) - { - /* Tvh doesn't have an approximate stop time => "any time" */ - return 0; - } - else - { - if (m_startWindowEnd == -1) // "any time" - return 0; - - return LocaltimeToUTC(m_startWindowEnd); - } + return m_startWindowEnd; } void AutoRecording::SetStartWindowEnd(int32_t end) diff --git a/src/tvheadend/entity/AutoRecording.h b/src/tvheadend/entity/AutoRecording.h index f56ccd9a..b69d6875 100644 --- a/src/tvheadend/entity/AutoRecording.h +++ b/src/tvheadend/entity/AutoRecording.h @@ -11,17 +11,16 @@ #include #include -#include #include #include namespace tvheadend { -class InstanceSettings; - namespace entity { +static constexpr int AUTOREC_START_ANYTIME{-1}; + class AutoRecording : public SeriesRecordingBase { public: @@ -30,12 +29,10 @@ class AutoRecording : public SeriesRecordingBase bool operator==(const AutoRecording& right); bool operator!=(const AutoRecording& right); - void SetSettings(const std::shared_ptr& settings) { m_settings = settings; } - - time_t GetStart() const; + int GetStartWindowBegin() const; void SetStartWindowBegin(int32_t begin); - time_t GetStop() const; + int GetStartWindowEnd() const; void SetStartWindowEnd(int32_t end); int64_t GetMarginStart() const; @@ -57,10 +54,10 @@ class AutoRecording : public SeriesRecordingBase void SetSeriesLink(const std::string& seriesLink); private: - std::shared_ptr m_settings; - - int32_t m_startWindowBegin{0}; // Begin of the starting window (minutes from midnight). - int32_t m_startWindowEnd{0}; // End of the starting window (minutes from midnight). + int32_t m_startWindowBegin{ + AUTOREC_START_ANYTIME}; // Minutes from midnight (up to 24*60) for the start of the time window (including). + int32_t m_startWindowEnd{ + AUTOREC_START_ANYTIME}; // Minutes from midnight (up to 24*60) for the end of the time window (including, cross-noon allowed) int64_t m_startExtra{0}; // Extra start minutes (pre-time). int64_t m_stopExtra{0}; // Extra stop minutes (post-time). uint32_t m_dupDetect{0}; // duplicate episode detect (numeric values: see dvr_autorec_dedup_t). diff --git a/src/tvheadend/entity/SeriesRecordingBase.cpp b/src/tvheadend/entity/SeriesRecordingBase.cpp index c0451f14..c2e6a2d9 100644 --- a/src/tvheadend/entity/SeriesRecordingBase.cpp +++ b/src/tvheadend/entity/SeriesRecordingBase.cpp @@ -7,8 +7,6 @@ #include "SeriesRecordingBase.h" -#include - using namespace tvheadend::entity; SeriesRecordingBase::SeriesRecordingBase(const std::string& id /*= ""*/) : m_sid(id) @@ -16,22 +14,6 @@ SeriesRecordingBase::SeriesRecordingBase(const std::string& id /*= ""*/) : m_sid m_id = GetNextIntId(); } -// static -time_t SeriesRecordingBase::LocaltimeToUTC(int32_t lctime) -{ - /* Note: lctime contains minutes from midnight (up to 24*60) as local time. */ - - /* complete lctime with current year, month, day, ... */ - time_t t = std::time(nullptr); - struct tm* tm_time = std::localtime(&t); - - tm_time->tm_hour = lctime / 60; - tm_time->tm_min = lctime % 60; - tm_time->tm_sec = 0; - - return std::mktime(tm_time); -} - // static unsigned int SeriesRecordingBase::GetNextIntId() { diff --git a/src/tvheadend/entity/SeriesRecordingBase.h b/src/tvheadend/entity/SeriesRecordingBase.h index b5d9658d..77304123 100644 --- a/src/tvheadend/entity/SeriesRecordingBase.h +++ b/src/tvheadend/entity/SeriesRecordingBase.h @@ -10,7 +10,6 @@ #include "RecordingBase.h" #include -#include #include namespace tvheadend::entity @@ -48,9 +47,6 @@ class SeriesRecordingBase : public RecordingBase void SetCreator(const std::string& creator) { m_creator = creator; } -protected: - static time_t LocaltimeToUTC(int32_t lctime); - private: static unsigned int GetNextIntId(); diff --git a/src/tvheadend/entity/TimeRecording.cpp b/src/tvheadend/entity/TimeRecording.cpp index 71131d8b..81447ba5 100644 --- a/src/tvheadend/entity/TimeRecording.cpp +++ b/src/tvheadend/entity/TimeRecording.cpp @@ -7,8 +7,28 @@ #include "TimeRecording.h" +#include + using namespace tvheadend::entity; +namespace +{ +time_t LocaltimeToUTC(int32_t lctime) +{ + /* Note: lctime contains minutes from midnight (up to 24*60) as local time. */ + + /* complete lctime with current year, month, day, ... */ + time_t t = std::time(nullptr); + struct tm* tm_time = std::localtime(&t); + + tm_time->tm_hour = lctime / 60; + tm_time->tm_min = lctime % 60; + tm_time->tm_sec = 0; + + return std::mktime(tm_time); +} +} // unnamed namespace + TimeRecording::TimeRecording(const std::string& id /*= ""*/) : SeriesRecordingBase(id) { }