aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphunkyfish <phunkyfish@gmail.com>2019-09-23 21:29:11 +0100
committerphunkyfish <phunkyfish@gmail.com>2019-09-26 08:53:15 +0100
commitd098a4f67553e5b72988ac86e2464e95ab15bf2e (patch)
treeb46a44fc9894f2a34e95bfe2cca065e25ca83338
parent17ae355295108961a7c4127230c9f2a85c65e0f9 (diff)
[pvr] support numbering all groups from one locally
-rw-r--r--addons/resource.language.en_gb/resources/strings.po17
-rwxr-xr-xsystem/settings/settings.xml9
-rw-r--r--xbmc/pvr/channels/PVRChannelGroup.cpp21
-rw-r--r--xbmc/pvr/channels/PVRChannelGroup.h1
-rw-r--r--xbmc/settings/Settings.cpp1
-rw-r--r--xbmc/settings/Settings.h1
6 files changed, 42 insertions, 8 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 3bf06af49f..0122938de3 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -10971,7 +10971,13 @@ msgctxt "#19315"
msgid "Backend order"
msgstr ""
-#empty strings from id 19316 to 19498
+#. pvr settings "Start all group channel numbers from 1" setting label
+#: system/settings/settings.xml
+msgctxt "#19316"
+msgid "Start group channel numbers from 1"
+msgstr ""
+
+#empty strings from id 19317 to 19498
#. label for epg genre value
#: xbmc/pvr/epg/Epg.cpp
@@ -18550,12 +18556,12 @@ msgstr ""
#: system/settings/settings.xml
msgctxt "#36205"
-msgid "Sort the channels by channel number from the backend, but use own numbering for channels."
+msgid "Sort the channels by channel number from the backend, but use local numbering for channels."
msgstr ""
#: system/settings/settings.xml
msgctxt "#36206"
-msgid "Use the channel numbering from the backend, instead of configuring them manually in the channel manager. Only works with one enabled PVR add-on!"
+msgid "Use the channel numbering from the backend. Only works with one enabled PVR add-on!"
msgstr ""
#: system/settings/settings.xml
@@ -19092,7 +19098,10 @@ msgctxt "#36305"
msgid "This category contains the settings for how picture file lists are handled."
msgstr ""
-#empty string with id 36306
+#: system/settings/settings.xml
+msgctxt "#36306"
+msgid "If not using backend channel numbers then start all groups channel numbers from 1."
+msgstr ""
#. Description of setting with label #13360 "Automatically generate thumbnails"
#: system/settings/settings.xml
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 27f896d889..ec98e18efe 100755
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -1195,6 +1195,15 @@
<default>false</default>
<control type="toggle" />
</setting>
+ <setting id="pvrmanager.startgroupchannelnumbersfromone" type="boolean" parent="pvrmanager.usebackendchannelnumbers" label="19316" help="36306">
+ <level>2</level>
+ <dependencies>
+ <dependency type="visible" on="property" name="pvrsettingvisible" setting="pvrmanager.usebackendchannelnumbers" operator="is">true</dependency>
+ <dependency type="enable" setting="pvrmanager.usebackendchannelnumbers" operator="is">false</dependency>
+ </dependencies>
+ <default>false</default>
+ <control type="toggle" />
+ </setting>
<setting id="pvrmanager.clientpriorities" type="action" label="19240" help="36210">
<level>2</level>
<dependencies>
diff --git a/xbmc/pvr/channels/PVRChannelGroup.cpp b/xbmc/pvr/channels/PVRChannelGroup.cpp
index f93704886a..291b153d5f 100644
--- a/xbmc/pvr/channels/PVRChannelGroup.cpp
+++ b/xbmc/pvr/channels/PVRChannelGroup.cpp
@@ -80,7 +80,8 @@ void CPVRChannelGroup::OnInit(void)
{
CServiceBroker::GetSettingsComponent()->GetSettings()->RegisterCallback(this, {
CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER,
- CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS
+ CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS,
+ CSettings::SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE
});
}
@@ -93,6 +94,7 @@ bool CPVRChannelGroup::Load(std::vector<std::shared_ptr<CPVRChannel>>& channelsT
m_bUsingBackendChannelOrder = settings->GetBool(CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER);
m_bUsingBackendChannelNumbers = settings->GetBool(CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS) &&
CServiceBroker::GetPVRManager().Clients()->EnabledClientAmount() == 1;
+ m_bStartGroupChannelNumbersFromOne = settings->GetBool(CSettings::SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE) && !m_bUsingBackendChannelNumbers;
int iChannelCount = m_iGroupId > 0 ? LoadFromDb() : 0;
CLog::LogFC(LOGDEBUG, LOGPVR, "%d channels loaded from the database for group '%s'", iChannelCount, GroupName().c_str());
@@ -725,6 +727,10 @@ bool CPVRChannelGroup::Renumber(void)
bool bReturn(false);
unsigned int iChannelNumber(0);
+ bool bUsingBackendChannelNumbers(CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS) &&
+ CServiceBroker::GetPVRManager().Clients()->EnabledClientAmount() == 1);
+ bool bStartGroupChannelNumbersFromOne(CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE) &&
+ !bUsingBackendChannelNumbers);
CSingleLock lock(m_critSection);
@@ -746,7 +752,10 @@ bool CPVRChannelGroup::Renumber(void)
}
else
{
- currentChannelNumber = m_allChannelsGroup->GetChannelNumber(sortedMember.channel);
+ if (bStartGroupChannelNumbersFromOne)
+ currentChannelNumber = CPVRChannelNumber(++iChannelNumber, 0);
+ else
+ currentChannelNumber = m_allChannelsGroup->GetChannelNumber(sortedMember.channel);
if (!sortedMember.clientChannelNumber.IsValid())
currentClientChannelNumber = m_allChannelsGroup->GetClientChannelNumber(sortedMember.channel);
@@ -812,23 +821,27 @@ void CPVRChannelGroup::OnSettingChanged(std::shared_ptr<const CSetting> setting)
}
const std::string &settingId = setting->GetId();
- if (settingId == CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER || settingId == CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS)
+ if (settingId == CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER || settingId == CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS ||
+ settingId == CSettings::SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE)
{
const std::shared_ptr<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings();
bool bUsingBackendChannelOrder = settings->GetBool(CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER);
bool bUsingBackendChannelNumbers = settings->GetBool(CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS) &&
CServiceBroker::GetPVRManager().Clients()->EnabledClientAmount() == 1;
+ bool bStartGroupChannelNumbersFromOne = settings->GetBool(CSettings::SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE) && !bUsingBackendChannelNumbers;
CSingleLock lock(m_critSection);
bool bChannelNumbersChanged = m_bUsingBackendChannelNumbers != bUsingBackendChannelNumbers;
bool bChannelOrderChanged = m_bUsingBackendChannelOrder != bUsingBackendChannelOrder;
+ bool bGroupChannelNumbersFromOneChanged = m_bStartGroupChannelNumbersFromOne != bStartGroupChannelNumbersFromOne;
m_bUsingBackendChannelOrder = bUsingBackendChannelOrder;
m_bUsingBackendChannelNumbers = bUsingBackendChannelNumbers;
+ m_bStartGroupChannelNumbersFromOne = bStartGroupChannelNumbersFromOne;
/* check whether this channel group has to be renumbered */
- if (bChannelOrderChanged || bChannelNumbersChanged)
+ if (bChannelOrderChanged || bChannelNumbersChanged || bGroupChannelNumbersFromOneChanged)
{
CLog::LogFC(LOGDEBUG, LOGPVR, "Renumbering channel group '%s' to use the backend channel order and/or numbers",
GroupName().c_str());
diff --git a/xbmc/pvr/channels/PVRChannelGroup.h b/xbmc/pvr/channels/PVRChannelGroup.h
index 653a4fba35..7cdf96d834 100644
--- a/xbmc/pvr/channels/PVRChannelGroup.h
+++ b/xbmc/pvr/channels/PVRChannelGroup.h
@@ -556,6 +556,7 @@ namespace PVR
std::vector<int> m_failedClientsForChannelGroupMembers;
CEventSource<PVREvent> m_events;
bool m_bIsSelectedGroup = false; /*!< Whether or not this group is currently selected */
+ bool m_bStartGroupChannelNumbersFromOne = false; /*!< true if we start group channel numbers from one when not using backend channel numbers, false otherwise */
private:
CDateTime GetEPGDate(EpgDateType epgDateType) const;
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index 2ef97ac9cb..92d67598f3 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -184,6 +184,7 @@ const std::string CSettings::SETTING_PVRMANAGER_PRESELECTPLAYINGCHANNEL = "pvrma
const std::string CSettings::SETTING_PVRMANAGER_SYNCCHANNELGROUPS = "pvrmanager.syncchannelgroups";
const std::string CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER = "pvrmanager.backendchannelorder";
const std::string CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS = "pvrmanager.usebackendchannelnumbers";
+const std::string CSettings::SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE = "pvrmanager.startgroupchannelnumbersfromone";
const std::string CSettings::SETTING_PVRMANAGER_CLIENTPRIORITIES = "pvrmanager.clientpriorities";
const std::string CSettings::SETTING_PVRMANAGER_CHANNELMANAGER = "pvrmanager.channelmanager";
const std::string CSettings::SETTING_PVRMANAGER_GROUPMANAGER = "pvrmanager.groupmanager";
diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h
index 8f3a172f58..534edd7e70 100644
--- a/xbmc/settings/Settings.h
+++ b/xbmc/settings/Settings.h
@@ -150,6 +150,7 @@ public:
static const std::string SETTING_PVRMANAGER_SYNCCHANNELGROUPS;
static const std::string SETTING_PVRMANAGER_BACKENDCHANNELORDER;
static const std::string SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS;
+ static const std::string SETTING_PVRMANAGER_STARTGROUPCHANNELNUMBERSFROMONE;
static const std::string SETTING_PVRMANAGER_CLIENTPRIORITIES;
static const std::string SETTING_PVRMANAGER_CHANNELMANAGER;
static const std::string SETTING_PVRMANAGER_GROUPMANAGER;