[SCM] kodi-pvr-hts/master: add Recording::GetTimerType()

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


The following commit has been merged in the master branch:
commit 5b0c43bc1523e1ff0cead925eb29d7a9f4f1b2d6
Author: Sam Stenvall <neggelandia at gmail.com>
Date:   Sun Jul 26 19:48:41 2015 +0300

    add Recording::GetTimerType()

diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index a703f4f..27ba9e4 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -790,15 +790,9 @@ bool CTvheadend::CreateTimer ( const Recording &tvhTmr, PVR_TIMER &tmr )
   strncpy(tmr.strSummary,
           tvhTmr.description.c_str(), sizeof(tmr.strSummary) - 1);
   tmr.state              = tvhTmr.state;
-  tmr.iTimerType         = !tvhTmr.timerecId.empty()
-                            ? TIMER_ONCE_CREATED_BY_TIMEREC
-                            : !tvhTmr.autorecId.empty()
-                              ? TIMER_ONCE_CREATED_BY_AUTOREC
-                              : tvhTmr.eventId
-                                ? TIMER_ONCE_EPG
-                                : TIMER_ONCE_MANUAL;
   tmr.iPriority          = tvhTmr.priority;
   tmr.iLifetime          = tvhTmr.retention;
+  tmr.iTimerType         = tvhTmr.GetTimerType();
   tmr.iMaxRecordings     = 0;                // not supported by tvh
   tmr.iRecordingGroup    = 0;                // not supported by tvh
   tmr.iPreventDuplicateEpisodes = 0;         // n/a for one-shot timers
diff --git a/src/tvheadend/entity/Recording.h b/src/tvheadend/entity/Recording.h
index eb71399..b0b0c46 100644
--- a/src/tvheadend/entity/Recording.h
+++ b/src/tvheadend/entity/Recording.h
@@ -45,6 +45,8 @@ namespace tvheadend
 
     /**
      * Represents a recording or a timer
+     * TODO: Create separate classes for recordings and timers since a 
+     * recording obviously can't have a "timer type"
      */
     class Recording : public Entity
     {
@@ -75,6 +77,21 @@ namespace tvheadend
           state == PVR_TIMER_STATE_RECORDING;
       }
 
+      /**
+       * @return the type of timer
+       */
+      unsigned int GetTimerType() const
+      {
+        if (!timerecId.empty())
+          return TIMER_ONCE_CREATED_BY_TIMEREC;
+        else if (!autorecId.empty())
+          return TIMER_ONCE_CREATED_BY_AUTOREC;
+        else if (eventId != 0)
+          return TIMER_ONCE_EPG;
+        else
+          return TIMER_ONCE_MANUAL;
+      }
+
       uint32_t         channel;
       uint32_t         eventId;
       int64_t          start;

-- 
kodi-pvr-hts packaging



More information about the pkg-multimedia-commits mailing list