[SCM] kodi-pvr-hts/master: add a setting to select which streaming profile should be used, and display an error notification during startup if the specified profile name is not valid
tiber-guest at users.alioth.debian.org
tiber-guest at users.alioth.debian.org
Wed Mar 2 23:01:48 UTC 2016
The following commit has been merged in the master branch:
commit e30cbdcb711b58a6d53b2986553c6221456187ff
Author: Sam Stenvall <sam.stenvall at nordsoftware.com>
Date: Sun Oct 18 13:35:02 2015 +0300
add a setting to select which streaming profile should be used, and
display an error notification during startup if the specified profile
name is not valid
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 4fa3452..35d77ec 100644
--- a/pvr.hts/resources/language/resource.language.en_gb/strings.po
+++ b/pvr.hts/resources/language/resource.language.en_gb/strings.po
@@ -225,3 +225,19 @@ msgstr ""
msgctxt "#30456"
msgid "Subscription error"
msgstr ""
+
+#empty strings from id 30456 to 30499
+
+msgctxt "#30500"
+msgid "Streaming"
+msgstr ""
+
+msgctxt "#30501"
+msgid "Streaming profile to use"
+msgstr ""
+
+#. Check streaming profile validity during startup
+#: src/client.cpp
+msgctxt "#30502"
+msgid "Streaming profile %s is not available"
+msgstr ""
diff --git a/pvr.hts/resources/settings.xml b/pvr.hts/resources/settings.xml
index 47c8ce7..6af8bd8 100644
--- a/pvr.hts/resources/settings.xml
+++ b/pvr.hts/resources/settings.xml
@@ -15,6 +15,9 @@
<setting id="autorec_approxtime" type="enum" label="30051" lvalues="30052|30053" default="0"/>
<setting id="autorec_maxdiff" enable="eq(-1,1)" type="slider" option="int" range="0,5,120" label="30054" default="15" />
+ <setting label="30500" type="lsep"/>
+ <setting id="streaming_profile" type="text" label="30501" default="" />
+
<setting label="30400" type="lsep"/>
<setting id="pretuner_enabled" type="bool" label="30403" default="false" />
<setting id="total_tuners" enable="eq(-1,true)" type="slider" option="int" range="2,1,10" label="30401" default="2" />
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index 6dadf14..18dd9ff 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -153,6 +153,18 @@ void CTvheadend::QueryAvailableProfiles()
htsmsg_destroy(m);
}
+bool CTvheadend::HasStreamingProfile(const std::string &streamingProfile) const
+{
+ return std::find_if(
+ m_profiles.cbegin(),
+ m_profiles.cend(),
+ [&streamingProfile](const Profile &profile)
+ {
+ return profile.GetName() == streamingProfile;
+ }
+ ) != m_profiles.cend();
+}
+
/* **************************************************************************
* Tags
* *************************************************************************/
@@ -1392,6 +1404,19 @@ void CTvheadend::SyncCompleted ( void )
SyncDvrCompleted();
SyncEpgCompleted();
m_asyncState.SetState(ASYNC_DONE);
+
+ /* Query the server for available streaming profiles */
+ QueryAvailableProfiles();
+
+ /* Show a notification if the profile is not available */
+ std::string streamingProfile = Settings::GetInstance().GetStreamingProfile();
+
+ if (!streamingProfile.empty() && !HasStreamingProfile(streamingProfile))
+ {
+ XBMC->QueueNotification(
+ QUEUE_ERROR,
+ XBMC->GetLocalizedString(30502), streamingProfile.c_str());
+ }
}
void CTvheadend::SyncChannelsCompleted ( void )
diff --git a/src/Tvheadend.h b/src/Tvheadend.h
index 39d5226..aa1ab2c 100644
--- a/src/Tvheadend.h
+++ b/src/Tvheadend.h
@@ -403,17 +403,23 @@ public:
PVR_ERROR GetEpg ( ADDON_HANDLE handle, const PVR_CHANNEL &chn,
time_t start, time_t end );
+private:
+ bool CreateTimer ( const tvheadend::entity::Recording &tvhTmr, PVR_TIMER &tmr );
+
+ uint32_t GetNextUnnumberedChannelNumber ();
+ std::string GetImageURL ( const char *str );
+
/**
* Queries the server for available streaming profiles and populates
* m_profiles
*/
void QueryAvailableProfiles();
-
-private:
- bool CreateTimer ( const tvheadend::entity::Recording &tvhTmr, PVR_TIMER &tmr );
- uint32_t GetNextUnnumberedChannelNumber ();
- std::string GetImageURL ( const char *str );
+ /**
+ * @param streamingProfile the streaming profile to check for
+ * @return whether the server supports the specified streaming profile
+ */
+ bool HasStreamingProfile(const std::string &streamingProfile) const;
/**
* The streaming profiles available on the server
diff --git a/src/tvheadend/Settings.cpp b/src/tvheadend/Settings.cpp
index 1f5a019..b7a60c6 100644
--- a/src/tvheadend/Settings.cpp
+++ b/src/tvheadend/Settings.cpp
@@ -38,6 +38,7 @@ const int Settings::DEFAULT_TOTAL_TUNERS = 1; // total tuners >
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; // mins
+const std::string Settings::DEFAULT_STREAMING_PROFILE = "";
void Settings::ReadSettings()
{
@@ -66,6 +67,9 @@ void Settings::ReadSettings()
/* Auto recordings */
SetAutorecApproxTime(ReadIntSetting("autorec_approxtime", DEFAULT_APPROX_TIME));
SetAutorecMaxDiff(ReadIntSetting("autorec_maxdiff", DEFAULT_AUTOREC_MAXDIFF));
+
+ /* Streaming */
+ SetStreamingProfile(ReadStringSetting("streaming_profile", DEFAULT_STREAMING_PROFILE));
}
ADDON_STATUS Settings::SetSetting(const std::string &key, const void *value)
@@ -108,6 +112,9 @@ ADDON_STATUS Settings::SetSetting(const std::string &key, const void *value)
return SetIntSetting(GetAutorecApproxTime(), value);
else if (key == "autorec_maxdiff")
return SetIntSetting(GetAutorecMaxDiff(), value);
+ /* Streaming */
+ else if (key == "streaming_profile")
+ return SetStringSetting(GetStreamingProfile(), value);
else
{
tvherror("Settings::SetSetting - unknown setting '%s'", key.c_str());
diff --git a/src/tvheadend/Settings.h b/src/tvheadend/Settings.h
index f234010..a0429d1 100644
--- a/src/tvheadend/Settings.h
+++ b/src/tvheadend/Settings.h
@@ -47,6 +47,7 @@ namespace tvheadend {
static const int DEFAULT_PRETUNER_CLOSEDELAY; // secs
static const int DEFAULT_AUTOREC_MAXDIFF; // mins. Maximum difference between real and approximate start time for auto recordings
static const int DEFAULT_APPROX_TIME; // mins
+ static const std::string DEFAULT_STREAMING_PROFILE;
/**
* Singleton getter for the instance
@@ -84,6 +85,7 @@ namespace tvheadend {
int GetPreTunerCloseDelay() const { return m_iPreTunerCloseDelay; }
bool GetAutorecApproxTime() const { return m_bAutorecApproxTime; }
int GetAutorecMaxDiff() const { return m_iPreTunerCloseDelay; }
+ std::string GetStreamingProfile() const { return m_strStreamingProfile; }
private:
Settings()
@@ -99,7 +101,8 @@ namespace tvheadend {
m_iTotalTuners(DEFAULT_TOTAL_TUNERS),
m_iPreTunerCloseDelay(DEFAULT_PRETUNER_CLOSEDELAY),
m_bAutorecApproxTime(DEFAULT_APPROX_TIME),
- m_iAutorecMaxDiff(DEFAULT_AUTOREC_MAXDIFF) {}
+ m_iAutorecMaxDiff(DEFAULT_AUTOREC_MAXDIFF),
+ m_strStreamingProfile{DEFAULT_STREAMING_PROFILE} {}
Settings(Settings const &) = delete;
void operator=(Settings const &) = delete;
@@ -120,6 +123,7 @@ namespace tvheadend {
void SetPreTunerCloseDelay(int value) { m_iPreTunerCloseDelay = value; }
void SetAutorecApproxTime(bool value) { m_bAutorecApproxTime = value; }
void SetAutorecMaxDiff(int value) { m_iAutorecMaxDiff = value; }
+ void SetStreamingProfile(const std::string &value) { m_strStreamingProfile = value; }
/**
* Read/Set values according to definition in settings.xml
@@ -146,6 +150,7 @@ namespace tvheadend {
int m_iPreTunerCloseDelay;
bool m_bAutorecApproxTime;
int m_iAutorecMaxDiff;
+ std::string m_strStreamingProfile;
};
}
--
kodi-pvr-hts packaging
More information about the pkg-multimedia-commits
mailing list