Skip to content

Commit

Permalink
Allow enabling smartTV
Browse files Browse the repository at this point in the history
Fixes #204
  • Loading branch information
rbuehlma committed May 20, 2024
1 parent 4f611cf commit a49d36a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ msgstr "Lädt nur Kanäle welche in favorisierter Liste enthalten sind."
#. Selection spinner on settings to get wanted stream type
#: pvr.zattoo/resources/settings.xml
msgctxt "#30004"
msgid "Stream type"
msgstr "Stream-Typ"
msgid "Smart TV"
msgstr ""

#. Help text to setting #30004
#: pvr.zattoo/resources/settings.xml
msgctxt "#30005"
msgid "To select wanted encrypted stream type."
msgstr "Um den gewünschten verschlüsselten Stream-Typ auszuwählen."
msgid "Verwende Smart TV Abo"
msgstr ""

#. Text setting to set used parental pin
#: pvr.zattoo/resources/settings.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ msgstr ""
#. Selection spinner on settings to get wanted stream type
#: pvr.zattoo/resources/settings.xml
msgctxt "#30004"
msgid "Stream type"
msgid "Smart TV"
msgstr ""

#. Help text to setting #30004
#: pvr.zattoo/resources/settings.xml
msgctxt "#30005"
msgid "To select wanted encrypted stream type."
msgid "Use Smart TV subscription"
msgstr ""

#. Text setting to set used parental pin
Expand Down
5 changes: 5 additions & 0 deletions pvr.zattoo/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
<level>0</level>
<default>false</default>
<control type="toggle" />
</setting>
<setting id="smarttv" type="boolean" label="30004" help="30005">
<level>0</level>
<default>false</default>
<control type="toggle" />
</setting>
<setting id="drmLevel" type="integer" label="30398" help="30399">
<level>0</level>
Expand Down
11 changes: 9 additions & 2 deletions src/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,15 @@ bool Session::SendHello()
std::string uuid = m_httpClient->GetUUID();
kodi::Log(ADDON_LOG_DEBUG, "Send hello.");
std::ostringstream dataStream;
dataStream << "uuid=" << uuid << "&lang=en&app_version=3.2038.0&format=json&client_app_token="
<< m_appToken;
dataStream << "lang=en&";
if (m_settings->GetSmartTV()) {
dataStream << "app_version=2.2409.1&"
<< "app_tid=01054a65-1f0d-4a00-a441-44c2ec5fa357&"
<< "device_type=android_bigscreen 30/zattoo_2.2409.1/NVIDIA/SHIELD Android TV/mdarcy/1920x1080";
} else {
dataStream << "app_version=3.2038.0";
}
dataStream << "&uuid=" << uuid << "&format=json&client_app_token=" << m_appToken;
int statusCode;
std::string jsonString = m_httpClient->HttpPost(m_providerUrl + "/zapi/v3/session/hello", dataStream.str(), statusCode);

Expand Down
18 changes: 17 additions & 1 deletion src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ bool CSettings::Load()
"Couldn't get 'favoritesonly' setting, falling back to 'false' as default");
m_zatFavoritesOnly = false;
}

if (!kodi::addon::CheckSettingBoolean("smarttv", m_smartTV))
{
/* If setting is unknown fallback to defaults */
kodi::Log(ADDON_LOG_ERROR,
"Couldn't get 'smarttv' setting, falling back to 'false' as default");
m_smartTV = false;
}

if (!kodi::addon::CheckSettingBoolean("enableDolby", m_zatEnableDolby))
{
Expand Down Expand Up @@ -104,7 +112,15 @@ ADDON_STATUS CSettings::SetSetting(const std::string& settingName,
return ADDON_STATUS_NEED_RESTART;
}
}
else if (settingName == "enableDolby")
else if (settingName == "smarttv")
{
kodi::Log(ADDON_LOG_DEBUG, "Changed Setting 'smarttv' from %u to %u", m_smartTV, settingValue.GetBoolean());
if (m_smartTV != settingValue.GetBoolean())
{
m_smartTV = settingValue.GetBoolean();
return ADDON_STATUS_NEED_RESTART;
}
} else if (settingName == "enableDolby")
{
kodi::Log(ADDON_LOG_DEBUG, "Changed Setting 'enableDolby' from %u to %u", m_zatEnableDolby, settingValue.GetBoolean());
if (m_zatEnableDolby != settingValue.GetBoolean())
Expand Down
2 changes: 2 additions & 0 deletions src/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ATTR_DLL_LOCAL CSettings
const std::string& GetZatUsername() const { return m_zatUsername; }
const std::string& GetZatPassword() const { return m_zatPassword; }
bool GetZatFavoritesOnly() const { return m_zatFavoritesOnly; }
bool GetSmartTV() const { return m_smartTV; }
bool GetZatEnableDolby() const { return m_zatEnableDolby; }
bool GetSkipStartOfProgramme() const { return m_skipStartOfProgramme; }
int DrmLevel() const { return m_drmLevel; }
Expand All @@ -31,6 +32,7 @@ class ATTR_DLL_LOCAL CSettings
std::string m_zatUsername;
std::string m_zatPassword;
bool m_zatFavoritesOnly = false;
bool m_smartTV = false;
bool m_zatEnableDolby = true;
bool m_skipStartOfProgramme = true;
int m_drmLevel = 0;
Expand Down

0 comments on commit a49d36a

Please sign in to comment.