From d6063ca8f6ba61a1c843dace548f9ec8f0a4fa9f Mon Sep 17 00:00:00 2001 From: emveepee Date: Fri, 30 Jul 2021 19:25:05 -0400 Subject: [PATCH] Kodi EDL limit (#175) Kodi PVR only allows 32 EDL entries. Co-authored-by: emveepee --- pvr.nextpvr/addon.xml.in | 2 +- pvr.nextpvr/changelog.txt | 3 +++ src/Recordings.cpp | 11 ++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pvr.nextpvr/addon.xml.in b/pvr.nextpvr/addon.xml.in index 13a90e4c..02e42849 100644 --- a/pvr.nextpvr/addon.xml.in +++ b/pvr.nextpvr/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.nextpvr/changelog.txt b/pvr.nextpvr/changelog.txt index db4001a7..c1faa8d9 100644 --- a/pvr.nextpvr/changelog.txt +++ b/pvr.nextpvr/changelog.txt @@ -1,3 +1,6 @@ +v8.2.6 +- Kodi has a limit of 32 EDL breaks in PVR + v8.2.5 - Update timer from a recurring recording - Remove extra parameter on log call diff --git a/src/Recordings.cpp b/src/Recordings.cpp index 5ef86f51..581aa56c 100644 --- a/src/Recordings.cpp +++ b/src/Recordings.cpp @@ -602,11 +602,20 @@ PVR_ERROR Recordings::GetRecordingEdl(const kodi::addon::PVRRecording& recording tinyxml2::XMLDocument doc; if (m_request.DoMethodRequest(request, doc) == tinyxml2::XML_SUCCESS) { - int index = 0; + int numEDL = 0; tinyxml2::XMLNode* commercialsNode = doc.RootElement()->FirstChildElement("commercials"); tinyxml2::XMLNode* pCommercialNode; for (pCommercialNode = commercialsNode->FirstChildElement("commercial"); pCommercialNode; pCommercialNode = pCommercialNode->NextSiblingElement()) { + if (numEDL++ == PVR_ADDON_EDL_LENGTH) + { + /* PVR core stores EDL breaks in a hard-coded array in PVRClient.cpp PVR_EDL_ENTRY edl_array[PVR_ADDON_EDL_LENGTH]; + * currently https://github.com/xbmc/xbmc/blob/master/xbmc/pvr/addons/PVRClient.cpp#L1056 + * This check avoids overflowing this arrray */ + + kodi::Log(ADDON_LOG_WARNING, "Maximum EDL entries reached"); + break; + } kodi::addon::PVREDLEntry entry; std::string buffer; XMLUtils::GetString(pCommercialNode, "start", buffer);