diff --git a/src/WaipuData.cpp b/src/WaipuData.cpp index 51abde1..f1e22ab 100644 --- a/src/WaipuData.cpp +++ b/src/WaipuData.cpp @@ -104,7 +104,7 @@ std::string WaipuData::HttpRequestToCurl(Curl& curl, { content = curl.Get(url, statusCode); } - if (statusCode >= 200 && statusCode < 300) + if ((statusCode >= 200 && statusCode < 300) or statusCode == 403) return content; kodi::Log(ADDON_LOG_ERROR, "[Http-GET-Request] error. status: %i, body: %s", statusCode, @@ -1019,6 +1019,21 @@ std::string WaipuData::GetChannelStreamURL(int uniqueId, return ""; } + if (streamURLDoc.HasMember("status") && streamURLDoc["status"].GetInt() == 403) + { + if (streamURLDoc.HasMember("type")) + { + std::string error_type = streamURLDoc["type"].GetString(); + kodi::Log(ADDON_LOG_ERROR, "[GetStreamURL] ERROR 403: %s", error_type.c_str()); + if (error_type == "stream-url-provider/channel-forbidden") + { + m_channels.clear(); + kodi::addon::CInstancePVRClient::TriggerChannelUpdate(); + } + return ""; + } + } + if (!streamURLDoc.HasMember("streamUrl")) { kodi::Log(ADDON_LOG_ERROR, "[GetStreamURL] ERROR: missing param streamUrl"); @@ -1073,8 +1088,8 @@ PVR_ERROR WaipuData::GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& { if (group.GetIsRadio()) { - kodi::Log(ADDON_LOG_ERROR, - "[%s] ERROR: Function was called with a group having 'radio: true'", __FUNCTION__); + kodi::Log(ADDON_LOG_ERROR, "[%s] ERROR: Function was called with a group having 'radio: true'", + __FUNCTION__); return PVR_ERROR_INVALID_PARAMETERS; }