Skip to content

Commit

Permalink
[pvr] changed: add button to resume live playback when playing a reco…
Browse files Browse the repository at this point in the history
…rding
  • Loading branch information
opdenkamp committed Mar 5, 2015
1 parent e58b684 commit 2c1a822
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
12 changes: 10 additions & 2 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

#include "pvr/PVRManager.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "epg/EpgInfoTag.h"
#include "epg/EpgContainer.h"
#include "pvr/timers/PVRTimers.h"
#include "pvr/recordings/PVRRecording.h"

Expand Down Expand Up @@ -414,7 +414,8 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE },
{ "hasepg", VIDEOPLAYER_HAS_EPG },
{ "parentalrating", VIDEOPLAYER_PARENTAL_RATING },
{ "isstereoscopic", VIDEOPLAYER_IS_STEREOSCOPIC },
{ "stereoscopicmode", VIDEOPLAYER_STEREOSCOPIC_MODE }
{ "stereoscopicmode", VIDEOPLAYER_STEREOSCOPIC_MODE },
{ "canresumelivetv", VIDEOPLAYER_CAN_RESUME_LIVE_TV },
};

const infomap mediacontainer[] = {{ "hasfiles", CONTAINER_HASFILES },
Expand Down Expand Up @@ -2675,6 +2676,13 @@ bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListI
bReturn = !m_videoInfo.stereoMode.empty();
}
break;
case VIDEOPLAYER_CAN_RESUME_LIVE_TV:
if (m_currentFile->HasPVRRecordingInfoTag())
{
EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::Get().GetTagById(m_currentFile->GetPVRRecordingInfoTag()->EpgEvent());
bReturn = (epgTag && epgTag->IsActive() && epgTag->ChannelTag());
}
break;
default: // default, use integer value different from 0 as true
{
int val;
Expand Down
1 change: 1 addition & 0 deletions xbmc/GUIInfoManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ namespace INFO
#define VIDEOPLAYER_AUDIO_LANG 313
#define VIDEOPLAYER_SUB_CHANNEL_NUMBER 314
#define VIDEOPLAYER_CHANNEL_NUMBER_LBL 315
#define VIDEOPLAYER_CAN_RESUME_LIVE_TV 316

#define CONTAINER_CAN_FILTER 342
#define CONTAINER_CAN_FILTERADVANCED 343
Expand Down
17 changes: 17 additions & 0 deletions xbmc/interfaces/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
#include "URL.h"
#include "music/MusicDatabase.h"
#include "cores/IPlayer.h"
#include "pvr/channels/PVRChannel.h"
#include "pvr/recordings/PVRRecording.h"

#include "filesystem/PluginDirectory.h"
#ifdef HAS_FILESYSTEM_RAR
Expand Down Expand Up @@ -1063,6 +1065,21 @@ int CBuiltins::Execute(const std::string& execString)
CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_REPEAT, 0, 0, iPlaylist, (int)state);
g_windowManager.SendThreadMessage(msg);
}
else if (StringUtils::StartsWithNoCase(parameter, "resumelivetv"))
{
CFileItem& fileItem(g_application.CurrentFileItem());
PVR::CPVRChannelPtr channel = fileItem.HasPVRRecordingInfoTag() ? fileItem.GetPVRRecordingInfoTag()->Channel() : PVR::CPVRChannelPtr();

if (channel)
{
CFileItem playItem(channel);
if (!g_application.PlayMedia(playItem, channel->IsRadio() ? PLAYLIST_MUSIC : PLAYLIST_VIDEO))
{
CLog::Log(LOGERROR, "ResumeLiveTv could not play channel: %s", channel->ChannelName().c_str());
return false;
}
}
}
}
else if (execute == "playwith")
{
Expand Down
12 changes: 12 additions & 0 deletions xbmc/pvr/recordings/PVRRecording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "dialogs/GUIDialogOK.h"
#include "epg/EpgContainer.h"
#include "pvr/PVRManager.h"
#include "settings/AdvancedSettings.h"
#include "PVRRecordings.h"
Expand Down Expand Up @@ -418,3 +419,14 @@ void CPVRRecording::CopyClientInfo(CVideoInfoTag *target) const
target->m_playCount = m_playCount;
target->m_resumePoint = m_resumePoint;
}

CPVRChannelPtr CPVRRecording::Channel(void) const
{
if (m_iEpgEventId)
{
EPG::CEpgInfoTagPtr epgTag = EPG::CEpgContainer::Get().GetTagById(m_iEpgEventId);
if (epgTag)
return epgTag->ChannelTag();
}
return CPVRChannelPtr();
}
9 changes: 8 additions & 1 deletion xbmc/pvr/recordings/PVRRecording.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class CVideoDatabase;
namespace PVR
{
class CPVRRecording;

typedef std::shared_ptr<PVR::CPVRRecording> CPVRRecordingPtr;

class CPVRChannel;
typedef std::shared_ptr<PVR::CPVRChannel> CPVRChannelPtr;

/*!
* @brief Representation of a CPVRRecording unique ID.
*/
Expand Down Expand Up @@ -203,6 +205,11 @@ namespace PVR
*/
int EpgEvent(void) const { return m_iEpgEventId; }

/*!
* @return Get the channel on which this recording is/was running
*/
CPVRChannelPtr Channel(void) const;

private:
CDateTime m_recordingTime; /*!< start time of the recording */
bool m_bGotMetaData;
Expand Down

0 comments on commit 2c1a822

Please sign in to comment.