Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SERVICE_PUBLIC FrontendServices : public Service
Q_CLASSINFO( "SendNotification_Method", "POST" )
Q_CLASSINFO( "SendAction_Method", "POST" )
Q_CLASSINFO( "PlayRecording_Method", "POST" )
Q_CLASSINFO( "PlayLiveTV_Method", "POST" )
Q_CLASSINFO( "PlayVideo_Method", "POST" )
Q_CLASSINFO( "SendKey_Method", "POST" )

Expand Down Expand Up @@ -47,6 +48,7 @@ class SERVICE_PUBLIC FrontendServices : public Service
uint Width, uint Height) = 0;
virtual bool PlayRecording(int RecordedId, int ChanId,
const QDateTime &StartTime) = 0;
virtual bool PlayLiveTV(int ChanId) = 0;
virtual bool PlayVideo(const QString &Id,
bool UseBookmark) = 0;
virtual QStringList GetContextList(void) = 0;
Expand Down
38 changes: 38 additions & 0 deletions mythtv/programs/mythfrontend/services/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,44 @@ bool Frontend::PlayRecording(int RecordedId, int ChanId,
return false;
}

bool Frontend::PlayLiveTV(int ChanId)
{
if (ChanId <= 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("PlayLiveTV: Channel ID is invalid."));
return false;
}

// channel tuning is only available from state playback i.e. Live TV
if (GetMythUI()->GetCurrentLocation().toLower() != "playback")
{
GetMythMainWindow()->JumpTo(jumpMap["Live TV"]);

QTime timer;
timer.start();
while ((timer.elapsed() < FE_LONG_TO) &&
(GetMythUI()->GetCurrentLocation().toLower() != "playback"))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}

if (GetMythUI()->GetCurrentLocation().toLower() == "playback")
{
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("PlayLiveTV, ChanID: %1")
.arg(ChanId));

QString message = QString("NETWORK_CONTROL PLAY CHANID %1")
.arg(ChanId);

MythEvent me(message);
gCoreContext->dispatch(me);
return true;
}

return false;
}

bool Frontend::PlayVideo(const QString &Id, bool UseBookmark)
{
if (TV::IsTVRunning())
Expand Down
1 change: 1 addition & 0 deletions mythtv/programs/mythfrontend/services/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Frontend : public FrontendServices
uint Width, uint Height) override; // FrontendServices
bool PlayRecording(int RecordedId, int ChanId,
const QDateTime &StartTime) override; // FrontendServices
bool PlayLiveTV(int ChanId) override; // FrontendServices
bool PlayVideo(const QString &Id, bool UseBookmark) override; // FrontendServices
QStringList GetContextList(void) override; // FrontendServices
DTC::FrontendActionList* GetActionList(const QString &Context) override; // FrontendServices
Expand Down