Skip to content

Commit

Permalink
Add recording directories (#165)
Browse files Browse the repository at this point in the history
Backend API change allows passing recording directory name on pending shows.

Co-authored-by: emveepee <nospam>
  • Loading branch information
emveepee authored May 8, 2021
1 parent 75a24b0 commit 641436c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pvr.nextpvr/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.nextpvr"
version="8.2.2"
version="8.2.3"
name="NextPVR PVR Client"
provider-name="Graeme Blackley">
<requires>@ADDON_DEPENDS@
Expand Down
3 changes: 3 additions & 0 deletions pvr.nextpvr/changelog.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
22 changes: 18 additions & 4 deletions src/Timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -396,9 +411,8 @@ PVR_ERROR Timers::GetTimerTypes(std::vector<kodi::addon::PVRTimerType>& types)
}

/* PVR_Timer.iRecordingGroup values and presentation */
int i = 0;
static std::vector<kodi::addon::PVRTypeIntValue> 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]));
}
Expand Down

0 comments on commit 641436c

Please sign in to comment.