From 9ca7c66da76a376590b6d5c20b864e7530a2f773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20B=C3=BChlmann?= Date: Mon, 20 May 2024 11:32:03 +0200 Subject: [PATCH] Allow enabling smartTV Fixes #204 --- .../resource.language.de_de/strings.po | 8 ++++---- .../resource.language.en_gb/strings.po | 4 ++-- pvr.zattoo/resources/settings.xml | 5 +++++ src/Session.cpp | 11 +++++++++-- src/Settings.cpp | 18 +++++++++++++++++- src/Settings.h | 2 ++ 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/pvr.zattoo/resources/language/resource.language.de_de/strings.po b/pvr.zattoo/resources/language/resource.language.de_de/strings.po index cee4078..4951980 100644 --- a/pvr.zattoo/resources/language/resource.language.de_de/strings.po +++ b/pvr.zattoo/resources/language/resource.language.de_de/strings.po @@ -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 diff --git a/pvr.zattoo/resources/language/resource.language.en_gb/strings.po b/pvr.zattoo/resources/language/resource.language.en_gb/strings.po index 761f9a4..5d8760e 100644 --- a/pvr.zattoo/resources/language/resource.language.en_gb/strings.po +++ b/pvr.zattoo/resources/language/resource.language.en_gb/strings.po @@ -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 diff --git a/pvr.zattoo/resources/settings.xml b/pvr.zattoo/resources/settings.xml index 6929fa9..e19521e 100644 --- a/pvr.zattoo/resources/settings.xml +++ b/pvr.zattoo/resources/settings.xml @@ -26,6 +26,11 @@ 0 false + + + 0 + false + 0 diff --git a/src/Session.cpp b/src/Session.cpp index 302ab7d..7bbc6b6 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -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&client_app_token=" << m_appToken; + } + dataStream << "&uuid=" << uuid << "&format=json"; int statusCode; std::string jsonString = m_httpClient->HttpPost(m_providerUrl + "/zapi/v3/session/hello", dataStream.str(), statusCode); diff --git a/src/Settings.cpp b/src/Settings.cpp index 1ef4934..e5fabc7 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -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)) { @@ -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()) diff --git a/src/Settings.h b/src/Settings.h index 44e3727..717f06b 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -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; } @@ -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;