Skip to content

Commit

Permalink
Merge pull request #9839 from ksooo/pvr-fix-stop-recording
Browse files Browse the repository at this point in the history
[PVR] Fix 'Stop recording' from inside PVR channel window.
  • Loading branch information
ksooo committed May 20, 2016
2 parents 476da66 + 1b03f0a commit 9626f34
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions xbmc/pvr/timers/PVRTimers.cpp
Expand Up @@ -666,6 +666,23 @@ bool CPVRTimers::IsRecordingOnChannel(const CPVRChannel &channel) const
return false;
}

CPVRTimerInfoTagPtr CPVRTimers::GetActiveTimerForChannel(const CPVRChannelPtr &channel) const
{
CSingleLock lock(m_critSection);
for (const auto &tagsEntry : m_tags)
{
for (const auto &timersEntry : *tagsEntry.second)
{
if (timersEntry->IsRecording() &&
timersEntry->m_iClientChannelUid == channel->UniqueID() &&
timersEntry->m_iClientId == channel->ClientID())
return timersEntry;
}
}

return CPVRTimerInfoTagPtr();
}

CPVRTimerInfoTagPtr CPVRTimers::GetTimerForEpgTag(const CEpgInfoTagPtr &epgTag) const
{
if (epgTag)
Expand Down
7 changes: 7 additions & 0 deletions xbmc/pvr/timers/PVRTimers.h
Expand Up @@ -106,6 +106,13 @@ namespace PVR
*/
bool IsRecordingOnChannel(const CPVRChannel &channel) const;

/*!
* @brief Obtain the active timer for a given channel.
* @param channel The channel to check.
* @return the timer, null otherwise.
*/
CPVRTimerInfoTagPtr GetActiveTimerForChannel(const CPVRChannelPtr &channel) const;

/*!
* @return The amount of timers that are currently recording
*/
Expand Down
8 changes: 8 additions & 0 deletions xbmc/pvr/windows/GUIWindowPVRBase.cpp
Expand Up @@ -609,6 +609,14 @@ bool CGUIWindowPVRBase::DeleteTimer(CFileItem *item, bool bIsRecording, bool bDe
{
timer = item->GetEPGInfoTag()->Timer();
}
else if (item->IsPVRChannel())
{
const CEpgInfoTagPtr epgTag(item->GetPVRChannelInfoTag()->GetEPGNow());
if (epgTag)
timer = epgTag->Timer();
else
timer = g_PVRTimers->GetActiveTimerForChannel(item->GetPVRChannelInfoTag());
}

if (!timer)
{
Expand Down

0 comments on commit 9626f34

Please sign in to comment.