[SCM] kodi-pvr-hts/master: [settings] add defaults for DVR priority, lifetime and dubdetec

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 92b1919ec39f346e9cdb922a72b2bc439492ccb8
Author: Glenn-1990 <g_christiaensen at msn.com>
Date:   Tue Dec 15 14:46:25 2015 +0100

    [settings] add defaults for DVR priority, lifetime and dubdetec

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 0f6fe80..7eeed44 100644
--- a/pvr.hts/resources/language/resource.language.en_gb/strings.po
+++ b/pvr.hts/resources/language/resource.language.en_gb/strings.po
@@ -76,7 +76,23 @@ msgctxt "#30054"
 msgid "Maximum start time margin (minutes)"
 msgstr ""
 
-#empty strings from id 30055 to 30099
+msgctxt "#30055"
+msgid "Default priority"
+msgstr ""
+
+msgctxt "#30056"
+msgid "Default lifetime"
+msgstr ""
+
+msgctxt "#30057"
+msgid "Default duplicate detection"
+msgstr ""
+
+msgctxt "#30058"
+msgid "Defaults for new timers"
+msgstr ""
+
+#empty strings from id 30059 to 30099
 
 msgctxt "#30100"
 msgid "Data transfer"
diff --git a/pvr.hts/resources/settings.xml b/pvr.hts/resources/settings.xml
index 6af8bd8..d4b4fd7 100644
--- a/pvr.hts/resources/settings.xml
+++ b/pvr.hts/resources/settings.xml
@@ -28,6 +28,11 @@
     
     <setting label="30200" type="lsep"/>
     <setting id="trace_debug" type="bool" label="30201" default="false"/>
+    
+    <setting label="30058" type="lsep"/>
+    <setting id="dvr_priority" type="enum" label="30055" lvalues="30351|30352|30353|30354|30355" default="2"/>
+    <setting id="dvr_lifetime" type="enum" label="30056" values="1 day|3 days|5 days|1 week|2 weeks|3 weeks|1 month|2 months|3 months|6 months|1 year|2 years|3 years|Until space needed (tvh 4.1+)|Forever" default="8"/>
+    <setting id="dvr_dubdetect" type="enum" label="30057" lvalues="30356|30357|30358|30359|30360|30361" default="0"/>
   </category>
   
 </settings>
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index d223aa1..6ec6bd5 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -597,27 +597,21 @@ struct TimerType : PVR_TIMER_TYPE
             const std::string &description,
             const std::vector< std::pair<int, std::string> > &priorityValues
               = 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
-              = DVR_AUTOREC_RECORD_ALL)
+              = std::vector< std::pair<int, std::string> >())
   {
     memset(this, 0, sizeof(PVR_TIMER_TYPE));
 
     iId                              = id;
     iAttributes                      = attributes;
     iPrioritiesSize                  = priorityValues.size();
-    iPrioritiesDefault               = priorityDefault;
+    iPrioritiesDefault               = Settings::GetInstance().GetDvrPriority();
     iPreventDuplicateEpisodesSize    = dupEpisodesValues.size();
-    iPreventDuplicateEpisodesDefault = dupEpisodesDefault;
+    iPreventDuplicateEpisodesDefault = Settings::GetInstance().GetDvrDupdetect();
     iLifetimesSize                   = lifetimeValues.size();
-    iLifetimesDefault                = lifetimeDefault;
+    iLifetimesDefault                = Settings::GetInstance().GetDvrLifetime();
 
     strncpy(strDescription, description.c_str(), sizeof(strDescription) - 1);
 
@@ -731,8 +725,6 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         "",
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL,
-
         /* Values definitions for lifetime. */
         lifetimeValues)));
 
@@ -747,8 +739,6 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         "",
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL,
-
         /* Values definitions for lifetime. */
         lifetimeValues)));
 
@@ -765,8 +755,6 @@ 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,
-
         /* Values definitions for lifetime. */
         lifetimeValues)));
 
@@ -783,8 +771,6 @@ 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,
-
         /* Values definitions for lifetime. */
         lifetimeValues)));
 
@@ -808,8 +794,6 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size )
         "",
         /* Values definitions for priorities. */
         priorityValues,
-        DVR_PRIO_NORMAL,
-
         /* Values definitions for lifetime. */
         lifetimeValues)));
 
@@ -850,15 +834,10 @@ 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)));
+        deDupValues)));
   }
 
   /* Copy data to target array. */
diff --git a/src/tvheadend/Settings.cpp b/src/tvheadend/Settings.cpp
index 9920a3c..848816b 100644
--- a/src/tvheadend/Settings.cpp
+++ b/src/tvheadend/Settings.cpp
@@ -40,6 +40,9 @@ const int         Settings::DEFAULT_PRETUNER_CLOSEDELAY = 10; // secs
 const int         Settings::DEFAULT_AUTOREC_MAXDIFF     = 15; // mins. Maximum difference between real and approximate start time for auto recordings
 const int         Settings::DEFAULT_APPROX_TIME         = 0;  // don't use an approximate start time, use a fixed time instead for auto recordings
 const std::string Settings::DEFAULT_STREAMING_PROFILE   = "";
+const int         Settings::DEFAULT_DVR_PRIO            = DVR_PRIO_NORMAL;
+const int         Settings::DEFAULT_DVR_LIFETIME        = 8; // enum 8 = 3 months
+const int         Settings::DEFAULT_DVR_DUBDETECT       = DVR_AUTOREC_RECORD_ALL;
 
 void Settings::ReadSettings()
 {
@@ -71,6 +74,11 @@ void Settings::ReadSettings()
 
   /* Streaming */
   SetStreamingProfile(ReadStringSetting("streaming_profile", DEFAULT_STREAMING_PROFILE));
+
+  /* Default dvr settings */
+  SetDvrPriority(ReadIntSetting("dvr_priority", DEFAULT_DVR_PRIO));
+  SetDvrLifetime(ReadIntSetting("dvr_lifetime", DEFAULT_DVR_LIFETIME));
+  SetDvrDupdetect(ReadIntSetting("dvr_dubdetect", DEFAULT_DVR_DUBDETECT));
 }
 
 ADDON_STATUS Settings::SetSetting(const std::string &key, const void *value)
@@ -131,6 +139,13 @@ ADDON_STATUS Settings::SetSetting(const std::string &key, const void *value)
   /* Streaming */
   else if (key == "streaming_profile")
     return SetStringSetting(GetStreamingProfile(), value);
+  /* Default dvr settings */
+  else if (key == "dvr_priority")
+    return SetIntSetting(GetDvrPriority(), value);
+  else if (key == "dvr_lifetime")
+    return SetIntSetting(GetDvrLifetime(true), value);
+  else if (key == "dvr_dubdetect")
+    return SetIntSetting(GetDvrDupdetect(), value);
   else
   {
     tvherror("Settings::SetSetting - unknown setting '%s'", key.c_str());
@@ -189,4 +204,46 @@ ADDON_STATUS Settings::SetBoolSetting(int oldValue, const void *newValue)
   return ADDON_STATUS_NEED_RESTART;
 }
 
+int Settings::GetDvrLifetime(bool asEnum) const
+{
+  if (asEnum)
+    return m_iDvrLifetime;
+  else
+  {
+    switch (m_iDvrLifetime)
+    {
+      case 0:
+        return DVR_RET_1DAY;
+      case 1:
+        return DVR_RET_3DAY;
+      case 2:
+        return DVR_RET_5DAY;
+      case 3:
+        return DVR_RET_1WEEK;
+      case 4:
+        return DVR_RET_2WEEK;
+      case 5:
+        return DVR_RET_3WEEK;
+      case 6:
+        return DVR_RET_1MONTH;
+      case 7:
+        return DVR_RET_2MONTH;
+      case 8:
+        return DVR_RET_3MONTH;
+      case 9:
+        return DVR_RET_6MONTH;
+      case 10:
+        return DVR_RET_1YEAR;
+      case 11:
+        return DVR_RET_2YEARS;
+      case 12:
+        return DVR_RET_3YEARS;
+      case 13:
+        return DVR_RET_SPACE;
+      default:
+        return DVR_RET_FOREVER;
+    }
+  }
+}
+
 } // namespace tvheadend
diff --git a/src/tvheadend/Settings.h b/src/tvheadend/Settings.h
index 3113059..dd36dc8 100644
--- a/src/tvheadend/Settings.h
+++ b/src/tvheadend/Settings.h
@@ -21,6 +21,7 @@
 *
 */
 
+#include "../HTSPTypes.h"
 #include <string>
 
 #include "kodi/xbmc_addon_types.h"
@@ -49,6 +50,9 @@ namespace tvheadend {
     static const int         DEFAULT_AUTOREC_MAXDIFF; // mins. Maximum difference between real and approximate start time for auto recordings
     static const int         DEFAULT_APPROX_TIME;     // 0..1 (0 = use a fixed start time, 1 = use an approximate start time for auto recordings)
     static const std::string DEFAULT_STREAMING_PROFILE;
+    static const int         DEFAULT_DVR_PRIO;        // 0..4  (0 = max, 4 = min)
+    static const int         DEFAULT_DVR_LIFETIME;    // 0..14 (0 = 1 day, 14 = forever)
+    static const int         DEFAULT_DVR_DUBDETECT;   // 0..5  (0 = record all, 5 = limit to once a day)
 
     /**
      * Singleton getter for the instance
@@ -87,6 +91,9 @@ namespace tvheadend {
     bool        GetAutorecApproxTime() const { return m_bAutorecApproxTime; }
     int         GetAutorecMaxDiff() const { return m_iAutorecMaxDiff; }
     std::string GetStreamingProfile() const { return m_strStreamingProfile; }
+    int         GetDvrPriority() const { return m_iDvrPriority; }
+    int         GetDvrDupdetect() const { return m_iDvrDupdetect; }
+    int         GetDvrLifetime(bool asEnum = false) const;
 
   private:
     Settings()
@@ -104,7 +111,10 @@ namespace tvheadend {
       m_iPreTunerCloseDelay(DEFAULT_PRETUNER_CLOSEDELAY),
       m_bAutorecApproxTime(DEFAULT_APPROX_TIME),
       m_iAutorecMaxDiff(DEFAULT_AUTOREC_MAXDIFF),
-      m_strStreamingProfile(DEFAULT_STREAMING_PROFILE) {}
+      m_strStreamingProfile(DEFAULT_STREAMING_PROFILE),
+      m_iDvrPriority(DEFAULT_DVR_PRIO),
+      m_iDvrLifetime(DEFAULT_DVR_LIFETIME),
+      m_iDvrDupdetect(DEFAULT_DVR_DUBDETECT) {}
 
     Settings(Settings const &) = delete;
     void operator=(Settings const &) = delete;
@@ -126,6 +136,9 @@ namespace tvheadend {
     void SetAutorecApproxTime(bool value) { m_bAutorecApproxTime = value; }
     void SetAutorecMaxDiff(int value) { m_iAutorecMaxDiff = value; }
     void SetStreamingProfile(const std::string &value) { m_strStreamingProfile = value; }
+    void SetDvrPriority(int value) { m_iDvrPriority = value; }
+    void SetDvrLifetime(int value) { m_iDvrLifetime = value; }
+    void SetDvrDupdetect(int value) { m_iDvrDupdetect = value; }
 
     /**
      * Read/Set values according to definition in settings.xml
@@ -154,6 +167,9 @@ namespace tvheadend {
     bool        m_bAutorecApproxTime;
     int         m_iAutorecMaxDiff;
     std::string m_strStreamingProfile;
+    int         m_iDvrPriority;
+    int         m_iDvrLifetime;
+    int         m_iDvrDupdetect;
   };
 
 }

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list