From 641436c9a8b6e568c26a6d8f45e9b73ec4bc3697 Mon Sep 17 00:00:00 2001 From: emveepee Date: Sat, 8 May 2021 13:20:26 -0400 Subject: [PATCH] Add recording directories (#165) Backend API change allows passing recording directory name on pending shows. Co-authored-by: emveepee --- pvr.nextpvr/addon.xml.in | 2 +- pvr.nextpvr/changelog.txt | 3 +++ src/Timers.cpp | 22 ++++++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pvr.nextpvr/addon.xml.in b/pvr.nextpvr/addon.xml.in index 1ed34191..df2b6c6f 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 f30fe694..f449f1ac 100644 --- a/pvr.nextpvr/changelog.txt +++ b/pvr.nextpvr/changelog.txt @@ -1,3 +1,6 @@ +v8.2.3 +- Add directory for pending recordings server API update + v8.2.2 - Missing break, keyword searches became advanced text searches diff --git a/src/Timers.cpp b/src/Timers.cpp index ce7da8fd..8c2a98ab 100644 --- a/src/Timers.cpp +++ b/src/Timers.cpp @@ -191,8 +191,7 @@ PVR_ERROR Timers::GetTimers(kodi::addon::PVRTimersResultSet& results) std::string recordingDirectoryID; if (XMLUtils::GetString(pRulesNode, "RecordingDirectoryID", recordingDirectoryID)) { - int i = 0; - for (auto it = m_settings.m_recordingDirectories.begin(); it != m_settings.m_recordingDirectories.end(); ++it, i++) + for (unsigned int i = 0; i < m_settings.m_recordingDirectories.size(); ++i) { std::string bracketed = "[" + m_settings.m_recordingDirectories[i] + "]"; if (bracketed == recordingDirectoryID) @@ -319,6 +318,22 @@ bool Timers::UpdatePvrTimer(tinyxml2::XMLNode* pRecordingNode, kodi::addon::PVRT } } + if (status == "Pending") + { + std::string directory; + if (XMLUtils::GetString(pRecordingNode, "directory", directory)) + { + for (unsigned int i = 0; i < m_settings.m_recordingDirectories.size(); ++i) + { + if (directory == m_settings.m_recordingDirectories[i]) + { + tag.SetRecordingGroup(i); + break; + } + } + } + } + return true; } @@ -396,9 +411,8 @@ PVR_ERROR Timers::GetTimerTypes(std::vector& types) } /* PVR_Timer.iRecordingGroup values and presentation */ - int i = 0; static std::vector recordingGroupValues; - for (auto it = m_settings.m_recordingDirectories.begin(); it != m_settings.m_recordingDirectories.end(); ++it, i++) + for (unsigned int i = 0; i < m_settings.m_recordingDirectories.size(); ++i) { recordingGroupValues.emplace_back(kodi::addon::PVRTypeIntValue(i, m_settings.m_recordingDirectories[i])); }