Skip to content

Commit

Permalink
Merge pull request #433 from ksooo/fix-recording-user-stop
Browse files Browse the repository at this point in the history
Fixed: 'Stop recording' no longer aborts in-progress recordings (HTSP…
  • Loading branch information
ksooo authored Oct 26, 2019
2 parents d5488d2 + ecc542c commit bfb35bc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pvr.hts/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.hts"
version="4.4.19"
version="4.4.20"
name="Tvheadend HTSP Client"
provider-name="Adam Sutton, Sam Stenvall, Lars Op den Kamp, Kai Sommerfeld">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.hts/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
4.4.20
- Fixed: 'Stop recording' no longer aborts in-progress recordings (HTSP v26)

4.4.19
- Update build system version and cleanup
- Change kodi header include way
Expand Down
36 changes: 23 additions & 13 deletions src/Tvheadend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,27 @@ PVR_ERROR CTvheadend::AddTimer ( const PVR_TIMER &timer )

PVR_ERROR CTvheadend::DeleteTimer(const PVR_TIMER &timer, bool)
{
{
CLockObject lock(m_mutex);

const auto& it = m_recordings.find(timer.iClientIndex);
if (it != m_recordings.end() && it->second.IsRecording())
{
// This is a request to stop an active recording.
if (m_conn->GetProtocol() >= 26)
{
// gracefully stop the recording (mark as success in tvh)
return SendDvrDelete(timer.iClientIndex, "stopDvrEntry");
}
else
{
// abort the recording (mark as failure in tvh) - no other choice,
// because graceful stop HTSP method was not available before HTSP v26.
return SendDvrDelete(timer.iClientIndex, "cancelDvrEntry");
}
}
}

if ((timer.iTimerType == TIMER_ONCE_MANUAL) ||
(timer.iTimerType == TIMER_ONCE_EPG))
{
Expand All @@ -1262,19 +1283,8 @@ PVR_ERROR CTvheadend::DeleteTimer(const PVR_TIMER &timer, bool)
(timer.iTimerType == TIMER_ONCE_CREATED_BY_AUTOREC))
{
/* Read-only timer created by autorec or timerec */
CLockObject lock(m_mutex);

const auto &it = m_recordings.find(timer.iClientIndex);
if (it != m_recordings.end() && it->second.IsRecording())
{
/* This is actually a request to cancel an active recording. */
return SendDvrDelete(timer.iClientIndex, "cancelDvrEntry");
}
else
{
Logger::Log(LogLevel::LEVEL_ERROR, "timer is read-only");
return PVR_ERROR_INVALID_PARAMETERS;
}
Logger::Log(LogLevel::LEVEL_ERROR, "timer is read-only");
return PVR_ERROR_INVALID_PARAMETERS;
}
else
{
Expand Down

0 comments on commit bfb35bc

Please sign in to comment.