diff --git a/pvr.eon/addon.xml.in b/pvr.eon/addon.xml.in index 4581693..74cf4c5 100644 --- a/pvr.eon/addon.xml.in +++ b/pvr.eon/addon.xml.in @@ -1,7 +1,7 @@ diff --git a/pvr.eon/changelog.txt b/pvr.eon/changelog.txt index 20cff3b..9f6adad 100644 --- a/pvr.eon/changelog.txt +++ b/pvr.eon/changelog.txt @@ -20,5 +20,9 @@ v21.7.4 - Exploit some more EPG data (live, age, seasons, episodes) v21.7.5 - Fix startup with empty credentials and web -v20.7.6 +v21.7.6 - Try to fix armv7a +v21.7.7 + - Fix refresh token when updating +v21.7.8 + - New Setting filter for channel age rating diff --git a/pvr.eon/resources/language/resource.language.de_de/strings.po b/pvr.eon/resources/language/resource.language.de_de/strings.po index c168c8f..551bc48 100644 --- a/pvr.eon/resources/language/resource.language.de_de/strings.po +++ b/pvr.eon/resources/language/resource.language.de_de/strings.po @@ -240,6 +240,10 @@ msgctxt "#30055" msgid "Please enter or correct username and password in the settings" msgstr "Bitte Usernamen und Passwort in den Einstellungen ändern" +msgctxt "#30056" +msgid "Age Rating" +msgstr "Altersfreigabe" + msgctxt "#30500" msgid "Inputstream error" msgstr "Inputstream Fehler" diff --git a/pvr.eon/resources/language/resource.language.en_gb/strings.po b/pvr.eon/resources/language/resource.language.en_gb/strings.po index a6ead83..b556150 100644 --- a/pvr.eon/resources/language/resource.language.en_gb/strings.po +++ b/pvr.eon/resources/language/resource.language.en_gb/strings.po @@ -228,6 +228,11 @@ msgctxt "#30055" msgid "Please enter or correct username and password in the settings" msgstr "" +msgctxt "#30056" +msgid "Age Rating" +msgstr "" + + msgctxt "#30500" msgid "Inputstream error" msgstr "" diff --git a/pvr.eon/resources/language/resource.language.en_us/strings.po b/pvr.eon/resources/language/resource.language.en_us/strings.po index 46e336d..929c875 100644 --- a/pvr.eon/resources/language/resource.language.en_us/strings.po +++ b/pvr.eon/resources/language/resource.language.en_us/strings.po @@ -232,6 +232,10 @@ msgctxt "#30055" msgid "Please enter or correct username and password in the settings" msgstr "" +msgctxt "#30056" +msgid "Age Rating" +msgstr "" + msgctxt "#30500" msgid "Inputstream error" msgstr "" diff --git a/pvr.eon/resources/settings.xml b/pvr.eon/resources/settings.xml index 0c98281..8c4dd16 100644 --- a/pvr.eon/resources/settings.xml +++ b/pvr.eon/resources/settings.xml @@ -184,6 +184,14 @@ + + 0 + 18 + + false + + + diff --git a/src/Globals.h b/src/Globals.h index c1ce54b..9c00bac 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2011-2021 Team Kodi (https://kodi.tv) * Copyright (C) 2011 Pulse-Eight (http://www.pulse-eight.com/) * diff --git a/src/PVREon.cpp b/src/PVREon.cpp index 9591f85..187852d 100644 --- a/src/PVREon.cpp +++ b/src/PVREon.cpp @@ -311,26 +311,19 @@ bool CPVREon::GetDeviceFromSerial() { std::string postData; - if (m_platform == PLATFORM_ANDROIDTV) { - postData = "{\"deviceName\":\"" + EonParameters[m_platform].device_name + - "\",\"deviceType\":\"" + EonParameters[m_platform].device_type + - "\",\"modelName\":\"" + EonParameters[m_platform].device_model + - "\",\"platform\":\"" + EonParameters[m_platform].device_platform + - "\",\"serial\":\"" + m_device_serial + - "\",\"clientSwVersion\":\"" + EonParameters[m_platform].client_sw_version + - "\",\"clientSwBuild\":\"" + EonParameters[m_platform].client_sw_build + - "\",\"systemSwVersion\":{\"name\":\"" + EonParameters[m_platform].system_sw + - "\",\"version\":\"" + EonParameters[m_platform].system_version + - "\"},\"fcmToken\":\"\"}"; - //TODO: implement parameter fcmToken... - } else { - postData = "{\"deviceName\":\"\",\"deviceType\":\"" + EonParameters[m_platform].device_type + - "\",\"modelName\":\"" + EonParameters[m_platform].device_model + - "\",\"platform\":\"" + EonParameters[m_platform].device_platform + - "\",\"serial\":\"" + m_device_serial + - "\",\"clientSwVersion\":\"\",\"systemSwVersion\":{\"name\":\"" + EonParameters[m_platform].system_sw + - "\",\"version\":\"" + EonParameters[m_platform].system_version + "\"}}"; - } + postData = "{\"deviceName\":\"" + EonParameters[m_platform].device_name + + "\",\"deviceType\":\"" + EonParameters[m_platform].device_type + + "\",\"modelName\":\"" + EonParameters[m_platform].device_model + + "\",\"platform\":\"" + EonParameters[m_platform].device_platform + + "\",\"serial\":\"" + m_device_serial + + "\",\"clientSwVersion\":\"" + EonParameters[m_platform].client_sw_version; + if (m_platform == PLATFORM_ANDROIDTV) + postData += "\",\"clientSwBuild\":\"" + EonParameters[m_platform].client_sw_build; + postData += "\",\"systemSwVersion\":{\"name\":\"" + EonParameters[m_platform].system_sw + + "\",\"version\":\"" + EonParameters[m_platform].system_version + "\"}"; + if (m_platform == PLATFORM_ANDROIDTV) + postData += ",\"fcmToken\":\"\""; //TODO: implement parameter fcmToken... + postData += "}"; std::string url = m_api + "v1/devices"; @@ -660,6 +653,13 @@ bool CPVREon::LoadChannels(const bool isRadio) eon_channel.aaEnabled = Utils::JsonBoolOrFalse(channelItem, "aaEnabled"); eon_channel.subscribed = Utils::JsonBoolOrFalse(channelItem, "subscribed"); + int ageRating = 0; + try { + ageRating = std::stoi(Utils::JsonStringOrEmpty(channelItem,"ageRating")); + } catch (std::invalid_argument&e) { + + } + eon_channel.ageRating = ageRating; const rapidjson::Value& categories = channelItem["categories"]; for (rapidjson::Value::ConstValueIterator itr2 = categories.Begin(); itr2 != categories.End(); ++itr2) @@ -1022,7 +1022,8 @@ PVR_ERROR CPVREon::GetChannels(bool bRadio, kodi::addon::PVRChannelsResultSet& r for (const auto& channel : m_channels) { - if (channel.bRadio == bRadio) + int ageRating = m_settings->GetAgeRating(); + if (channel.bRadio == bRadio && ageRating >= channel.ageRating) { kodi::addon::PVRChannel kodiChannel; diff --git a/src/PVREon.h b/src/PVREon.h index 10ef3d1..9d95d01 100644 --- a/src/PVREon.h +++ b/src/PVREon.h @@ -48,6 +48,7 @@ struct EonChannel std::string sig; bool aaEnabled; bool subscribed; + int ageRating; // std::string strStreamURL; }; @@ -158,8 +159,6 @@ class ATTR_DLL_LOCAL CPVREon : public kodi::addon::CAddonBase, bool GetServer(bool isLive, EonServer& myServer); private: - PVR_ERROR CallMenuHook(const kodi::addon::PVRMenuhook& menuhook); - void SetStreamProperties(std::vector& properties, const std::string& url, const bool& realtime, const bool& playTimeshiftBuffer, const bool& isLive /*, diff --git a/src/Settings.cpp b/src/Settings.cpp index d9480a9..beffff8 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -171,6 +171,13 @@ bool CSettings::Load() return false; } + if (!kodi::addon::CheckSettingInt("agerating", m_eonAgeRating)) + { + /* If setting is unknown fallback to defaults */ + kodi::Log(ADDON_LOG_ERROR, "Couldn't get 'agerating' setting"); + return false; + } + return true; } diff --git a/src/Settings.h b/src/Settings.h index 5e47a77..95b25a0 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -21,6 +21,7 @@ class ATTR_DLL_LOCAL CSettings const int& GetEonServiceProvider() const { return m_eonServiceProvider; } const int& GetPlatform() const { return m_eonPlatform; } const int& GetInputstream() const { return m_eonInputstream; } + const int& GetAgeRating() const { return m_eonAgeRating; } const std::string& GetEonUsername() const { return m_eonUsername; } const std::string& GetEonPassword() const { return m_eonPassword; } const std::string& GetEonAccessToken() const { return m_eonAccessToken; } @@ -46,6 +47,7 @@ class ATTR_DLL_LOCAL CSettings int m_eonServiceProvider; int m_eonPlatform; int m_eonInputstream; + int m_eonAgeRating; std::string m_eonUsername; std::string m_eonPassword; std::string m_eonAccessToken; diff --git a/src/http/HttpClient.cpp b/src/http/HttpClient.cpp index 03a1580..4b026d2 100644 --- a/src/http/HttpClient.cpp +++ b/src/http/HttpClient.cpp @@ -370,6 +370,18 @@ std::string HttpClient::HttpRequest(const std::string& action, const std::string } if (refresh_successful) { content = HttpRequestToCurl(curl_reauth, action, url, postData, statusCode); + } else { + std::string refresh_token = m_settings->GetEonRefreshToken(); + if (!refresh_token.empty() && !(url.find(BROKER_URL) != std::string::npos || url.find("v1/devices") != std::string::npos)) { + // Try to get new token as last resort + m_settings->SetSetting("refreshtoken", ""); + refresh_successful = RefreshToken(); + access_token = m_settings->GetEonAccessToken(); + curl_reauth.AddHeader("Authorization", "bearer " + access_token); + if (refresh_successful) { + content = HttpRequestToCurl(curl_reauth, action, url, postData, statusCode); + } + } } }