[SCM] kodi-pvr-hts/master: [settings] limit the amount of lifetime settings in the GUI

tiber-guest at users.alioth.debian.org tiber-guest at users.alioth.debian.org
Wed Mar 2 23:01:51 UTC 2016


The following commit has been merged in the master branch:
commit 154c8d23872f45d96267bb5e1fb56e37337862fe
Author: Glenn-1990 <g_christiaensen at msn.com>
Date:   Tue Dec 15 14:46:10 2015 +0100

    [settings] limit the amount of lifetime settings in the GUI

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 5d8d5b8..0f6fe80 100644
--- a/pvr.hts/resources/language/resource.language.en_gb/strings.po
+++ b/pvr.hts/resources/language/resource.language.en_gb/strings.po
@@ -176,7 +176,69 @@ msgctxt "#30361"
 msgid "Record max once per day"
 msgstr ""
 
-#empty strings from id 30362 to 30399
+#empty strings from id 30362 to 30364
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30365"
+msgid "1 day"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30366"
+msgid "%d days"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30367"
+msgid "1 week"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30368"
+msgid "%d weeks"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30369"
+msgid "1 month"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30370"
+msgid "%d months"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30371"
+msgid "1 year"
+msgstr ""
+
+#. Recording lifetime representation
+#: src/Tvheadend.cpp
+msgctxt "#30372"
+msgid "%d years"
+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 30375 to 30399
 
 msgctxt "#30400"
 msgid "Predictive tuning"
diff --git a/src/HTSPTypes.h b/src/HTSPTypes.h
index 1b1bb2d..950f45c 100644
--- a/src/HTSPTypes.h
+++ b/src/HTSPTypes.h
@@ -54,6 +54,31 @@ typedef enum {
   DVR_AUTOREC_RECORD_ONCE_PER_DAY = 5
 } dvr_autorec_dedup_t;
 
+/*
+ * Defines for both the retention and removal of a dvr entry
+ * retention = lifetime of the database entry
+ * removal   = lifetime of the actual recording on disk
+ */
+typedef enum {
+  DVR_RET_DVRCONFIG = 0,            // the server will use it's own default value
+  DVR_RET_1DAY      = 1,            // the server will delete the db entry or recording after 1 day
+  DVR_RET_3DAY      = 3,            // ...
+  DVR_RET_5DAY      = 5,
+  DVR_RET_1WEEK     = 7,
+  DVR_RET_2WEEK     = 14,
+  DVR_RET_3WEEK     = 21,
+  DVR_RET_1MONTH    = 31,
+  DVR_RET_2MONTH    = 62,
+  DVR_RET_3MONTH    = 92,
+  DVR_RET_6MONTH    = 183,
+  DVR_RET_1YEAR     = 366,
+  DVR_RET_2YEARS    = 731,
+  DVR_RET_3YEARS    = 1096,
+  DVR_RET_ONREMOVE  = INT32_MAX-1,  // the server will delete the db entry when the actual recording gets deleted (retention only)
+  DVR_RET_SPACE     = INT32_MAX-1,  // the server may delete this recording if space for a new recording is needed (removal only)
+  DVR_RET_FOREVER   = INT32_MAX     // the server should never delete this recording or database entry, only the user can do this
+} dvr_retention_t;
+
 enum eHTSPEventType
 {
   HTSP_EVENT_NONE = 0,
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index d65a2f0..d223aa1 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -22,6 +22,9 @@
 #include <algorithm>
 #include <ctime>
 #include <memory>
+
+#include "platform/util/StringUtils.h"
+
 #include "Tvheadend.h"
 #include "tvheadend/utilities/Utilities.h"
 
@@ -596,6 +599,10 @@ struct TimerType : PVR_TIMER_TYPE
               = std::vector< std::pair<int, std::string> >(),
             int priorityDefault
               = DVR_PRIO_NORMAL,
+            const std::vector< std::pair<int, std::string> > &lifetimeValues
+              = std::vector< std::pair<int, std::string> >(),
+            int lifetimeDefault
+              = DVR_RET_SPACE,
             const std::vector< std::pair<int, std::string> > &dupEpisodesValues
               = std::vector< std::pair<int, std::string> >(),
             int dupEpisodesDefault
@@ -609,6 +616,8 @@ struct TimerType : PVR_TIMER_TYPE
     iPrioritiesDefault               = priorityDefault;
     iPreventDuplicateEpisodesSize    = dupEpisodesValues.size();
     iPreventDuplicateEpisodesDefault = dupEpisodesDefault;
+    iLifetimesSize                   = lifetimeValues.size();
+    iLifetimesDefault                = lifetimeDefault;
 
     strncpy(strDescription, description.c_str(), sizeof(strDescription) - 1);
 
@@ -625,6 +634,13 @@ struct TimerType : PVR_TIMER_TYPE
       preventDuplicateEpisodes[i].iValue = it->first;
       strncpy(preventDuplicateEpisodes[i].strDescription, it->second.c_str(), sizeof(preventDuplicateEpisodes[i].strDescription) - 1);
     }
+
+    i = 0;
+    for (auto it = lifetimeValues.begin(); it != lifetimeValues.end(); ++it, ++i)
+    {
+      lifetimes[i].iValue = it->first;
+      strncpy(lifetimes[i].strDescription, it->second.c_str(), sizeof(lifetimes[i].strDescription) - 1);
+    }
   }
 };
 
@@ -655,6 +671,28 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
     deDupValues.push_back(std::make_pair(DVR_AUTOREC_RECORD_ONCE_PER_DAY,             XBMC->GetLocalizedString(30361)));
   }
 
+  /* PVR_Timer.iLifetime values and presentation.*/
+  static std::vector< std::pair<int, std::string> > lifetimeValues;
+  if (lifetimeValues.size() == 0)
+  {
+    lifetimeValues.push_back(std::make_pair(DVR_RET_1DAY,    XBMC->GetLocalizedString(30365)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_3DAY,    StringUtils::Format(XBMC->GetLocalizedString(30366), 3)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_5DAY,    StringUtils::Format(XBMC->GetLocalizedString(30366), 5)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_1WEEK,   XBMC->GetLocalizedString(30367)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_2WEEK,   StringUtils::Format(XBMC->GetLocalizedString(30368), 2)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_3WEEK,   StringUtils::Format(XBMC->GetLocalizedString(30368), 3)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_1MONTH,  XBMC->GetLocalizedString(30369)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_2MONTH,  StringUtils::Format(XBMC->GetLocalizedString(30370), 2)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_3MONTH,  StringUtils::Format(XBMC->GetLocalizedString(30370), 3)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_6MONTH,  StringUtils::Format(XBMC->GetLocalizedString(30370), 6)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_1YEAR,   XBMC->GetLocalizedString(30371)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_2YEARS,  StringUtils::Format(XBMC->GetLocalizedString(30372), 2)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_3YEARS,  StringUtils::Format(XBMC->GetLocalizedString(30372), 3)));
+    if (m_conn.GetProtocol() >= 25)
+      lifetimeValues.push_back(std::make_pair(DVR_RET_SPACE,   XBMC->GetLocalizedString(30373)));
+    lifetimeValues.push_back(std::make_pair(DVR_RET_FOREVER, XBMC->GetLocalizedString(30374)));
+  }
+
   unsigned int TIMER_ONCE_MANUAL_ATTRIBS
     = PVR_TIMER_TYPE_IS_MANUAL           |
       PVR_TIMER_TYPE_SUPPORTS_CHANNELS   |
@@ -693,7 +731,10 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         "",
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL)));
+        DVR_PRIO_NORMAL,
+
+        /* Values definitions for lifetime. */
+        lifetimeValues)));
 
     timerTypes.push_back(
       /* One-shot epg based */
@@ -706,7 +747,10 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         "",
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL)));
+        DVR_PRIO_NORMAL,
+
+        /* Values definitions for lifetime. */
+        lifetimeValues)));
 
     timerTypes.push_back(
       /* Read-only one-shot for timers generated by timerec */
@@ -721,7 +765,10 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         XBMC->GetLocalizedString(30350), // "One Time (Scheduled by repeating timer)"
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL)));
+        DVR_PRIO_NORMAL,
+
+        /* Values definitions for lifetime. */
+        lifetimeValues)));
 
     timerTypes.push_back(
       /* Read-only one-shot for timers generated by autorec */
@@ -736,7 +783,10 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         XBMC->GetLocalizedString(30350), // "One Time (Scheduled by repeating timer)"
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL)));
+        DVR_PRIO_NORMAL,
+
+        /* Values definitions for lifetime. */
+        lifetimeValues)));
 
     timerTypes.push_back(
       /* Repeating manual (time and channel based) - timerec */
@@ -758,7 +808,10 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         "",
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL)));
+        DVR_PRIO_NORMAL,
+
+        /* Values definitions for lifetime. */
+        lifetimeValues)));
 
     unsigned int TIMER_REPEATING_EPG_ATTRIBS
       = PVR_TIMER_TYPE_IS_REPEATING                |
@@ -798,6 +851,11 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         /* Values definitions for priorities. */
         priorityValues,
         DVR_PRIO_NORMAL,
+
+        /* Values definitions for lifetime. */
+        lifetimeValues,
+        DVR_RET_SPACE,
+
         /* Values definitions for prevent duplicate episodes. */
         deDupValues,
         DVR_AUTOREC_RECORD_ALL)));

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list