Skip to content

Commit

Permalink
[PVR] Changed EpgInfoTag::[IsActive|WasActive|InTheFuture] to take
Browse files Browse the repository at this point in the history
      timeshifting into account. Fixes wrong event info shown at
      several places in kodi UI when timeshifting (e.g. Video OSD).
  • Loading branch information
ksooo committed Nov 2, 2014
1 parent a693300 commit cb779b4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
25 changes: 22 additions & 3 deletions xbmc/epg/EpgInfoTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "pvr/timers/PVRTimers.h"
#include "pvr/PVRManager.h"
#include "pvr/addons/PVRClients.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
Expand Down Expand Up @@ -263,23 +264,41 @@ bool CEpgInfoTag::Changed(void) const
return m_bChanged;
}

bool CEpgInfoTag::IsActive(void) const
CDateTime CEpgInfoTag::GetCurrentTime() const
{
CDateTime now = CDateTime::GetUTCDateTime();

CPVRChannelPtr channel;
if (g_PVRClients->GetPlayingChannel(channel))
{
if (channel == ChannelTag())
{
// Timeshifting active?
time_t time = g_PVRClients->GetPlayingTime();
if (time > 0) // returns 0 in case no client is currently playing
now = time;
}
}
return now;
}

bool CEpgInfoTag::IsActive(void) const
{
CDateTime now = GetCurrentTime();
CSingleLock lock(m_critSection);
return (m_startTime <= now && m_endTime > now);
}

bool CEpgInfoTag::WasActive(void) const
{
CDateTime now = CDateTime::GetUTCDateTime();
CDateTime now = GetCurrentTime();
CSingleLock lock(m_critSection);
return (m_endTime < now);
}

bool CEpgInfoTag::InTheFuture(void) const
{
CDateTime now = CDateTime::GetUTCDateTime();
CDateTime now = GetCurrentTime();
CSingleLock lock(m_critSection);
return (m_startTime > now);
}
Expand Down
5 changes: 5 additions & 0 deletions xbmc/epg/EpgInfoTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@ namespace EPG
*/
void UpdatePath(void);

/*!
* @brief Get current time, taking timeshifting into account.
*/
CDateTime GetCurrentTime(void) const;

bool m_bNotify; /*!< notify on start */
bool m_bChanged; /*!< keep track of changes to this entry */

Expand Down

0 comments on commit cb779b4

Please sign in to comment.