Skip to content

Commit

Permalink
Merge pull request #460 from ksooo/retention-default
Browse files Browse the repository at this point in the history
v7.1.0: Change default value for 'recordings lifetime' setting
  • Loading branch information
ksooo authored Jul 1, 2020
2 parents 0585290 + 9c9c258 commit 761b376
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pvr.hts/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hts"
version="7.0.1"
version="7.1.0"
name="Tvheadend HTSP Client"
provider-name="Adam Sutton, Sam Stenvall, Lars Op den Kamp, Kai Sommerfeld">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
7 changes: 7 additions & 0 deletions pvr.hts/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
7.1.0
- Add new setting value for recordings lifetime of timers created by Kodi: 'Use backend setting"
- Change default value for 'lifetime' setting from '3 months' to 'Use backend setting' to
avoid unintended loss of data
- Enforce reset of default value for lifetime' to 'Use backend setting' to avoid unintended loss
of data for existing addon configurations

7.0.1
- Fix hang during addon stop

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,12 @@ msgctxt "#30389"
msgid "Forever (tvh 4.1+)"
msgstr ""

#empty strings from id 30390 to 30399
#. Recording lifetime representation
msgctxt "#30390"
msgid "Use backend setting"
msgstr ""

#empty strings from id 30391 to 30399

msgctxt "#30400"
msgid "Predictive tuning"
Expand Down
5 changes: 3 additions & 2 deletions pvr.hts/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
</constraints>
<control type="spinner" format="string" />
</setting>
<setting id="dvr_lifetime" type="integer" label="30056" help="-1">
<setting id="dvr_lifetime2" type="integer" label="30056" help="-1">
<level>0</level>
<default>8</default> <!-- 3 months -->
<default>15</default> <!-- Use backend setting -->
<constraints>
<options>
<option label="30375">0</option> <!-- 1 day -->
Expand All @@ -220,6 +220,7 @@
<option label="30387">12</option> <!-- 3 years -->
<option label="30388">13</option> <!-- Until space needed (tvh 4.1+) -->
<option label="30389">14</option> <!-- Forever (tvh 4.1+) -->
<option label="30390">15</option> <!-- Use backend setting -->
</options>
</constraints>
<control type="spinner" format="string" />
Expand Down
1 change: 1 addition & 0 deletions src/Tvheadend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ struct TimerType : kodi::addon::PVRTimerType
void CTvheadend::GetLivetimeValues(std::vector<kodi::addon::PVRTypeIntValue>& lifetimeValues) const
{
lifetimeValues = {
{LifetimeMapper::TvhToKodi(DVR_RET_DVRCONFIG), kodi::GetLocalizedString(30390)},
{LifetimeMapper::TvhToKodi(DVR_RET_1DAY), kodi::GetLocalizedString(30375)},
{LifetimeMapper::TvhToKodi(DVR_RET_3DAY), kodi::GetLocalizedString(30376)},
{LifetimeMapper::TvhToKodi(DVR_RET_5DAY), kodi::GetLocalizedString(30377)},
Expand Down
11 changes: 7 additions & 4 deletions src/tvheadend/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ 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_LIFETIME = 15; // use backend setting
const int Settings::DEFAULT_DVR_DUPDETECT = DVR_AUTOREC_RECORD_ALL;
const bool Settings::DEFAULT_DVR_PLAYSTATUS = true;
const int Settings::DEFAULT_STREAM_CHUNKSIZE = 64; // KB
Expand Down Expand Up @@ -76,7 +76,7 @@ void Settings::ReadSettings()

/* Default dvr settings */
SetDvrPriority(ReadIntSetting("dvr_priority", DEFAULT_DVR_PRIO));
SetDvrLifetime(ReadIntSetting("dvr_lifetime", DEFAULT_DVR_LIFETIME));
SetDvrLifetime(ReadIntSetting("dvr_lifetime2", DEFAULT_DVR_LIFETIME));
SetDvrDupdetect(ReadIntSetting("dvr_dubdetect", DEFAULT_DVR_DUPDETECT));

/* Sever based play status */
Expand Down Expand Up @@ -155,7 +155,7 @@ ADDON_STATUS Settings::SetSetting(const std::string& key, const kodi::CSettingVa
/* Default dvr settings */
else if (key == "dvr_priority")
return SetIntSetting(GetDvrPriority(), value);
else if (key == "dvr_lifetime")
else if (key == "dvr_lifetime2")
return SetIntSetting(GetDvrLifetime(true), value);
else if (key == "dvr_dubdetect")
return SetIntSetting(GetDvrDupdetect(), value);
Expand Down Expand Up @@ -261,8 +261,11 @@ int Settings::GetDvrLifetime(bool asEnum) const
return DVR_RET_3YEARS;
case 13:
return DVR_RET_SPACE;
default:
case 14:
return DVR_RET_FOREVER;
case 15:
default:
return DVR_RET_DVRCONFIG;
}
}
}
2 changes: 1 addition & 1 deletion src/tvheadend/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Settings
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; // any dvr_prio_t numeric value
static const int DEFAULT_DVR_LIFETIME; // 0..14 (0 = 1 day, 14 = forever)
static const int DEFAULT_DVR_LIFETIME; // 0..15 (0 = 1 day, 15 = use backend setting)
static const int DEFAULT_DVR_DUPDETECT; // 0..5 (0 = record all, 5 = limit to once a day)
static const bool DEFAULT_DVR_PLAYSTATUS;
static const int DEFAULT_STREAM_CHUNKSIZE; // KB
Expand Down
8 changes: 6 additions & 2 deletions src/tvheadend/utilities/LifetimeMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class LifetimeMapper
static int TvhToKodi(uint32_t tvhLifetime)
{
// pvr addon api: addon defined special values must be less than zero
if (tvhLifetime == DVR_RET_SPACE)
if (tvhLifetime == DVR_RET_DVRCONFIG)
return -3;
else if (tvhLifetime == DVR_RET_SPACE)
return -2;
else if (tvhLifetime == DVR_RET_FOREVER)
return -1;
Expand All @@ -34,7 +36,9 @@ class LifetimeMapper

static uint32_t KodiToTvh(int kodiLifetime)
{
if (kodiLifetime == -2)
if (kodiLifetime == -3)
return DVR_RET_DVRCONFIG;
else if (kodiLifetime == -2)
return DVR_RET_SPACE;
else if (kodiLifetime == -1)
return DVR_RET_FOREVER;
Expand Down

0 comments on commit 761b376

Please sign in to comment.