From d86524d79f9fbe3eb8cc0b18c3f6f932686725e1 Mon Sep 17 00:00:00 2001 From: Justin Randall <2840408+JRRandall@users.noreply.github.com> Date: Fri, 26 Oct 2018 10:40:08 -0400 Subject: [PATCH 1/5] Add support for PlayLiveTV in frontend API --- .../mythfrontend/services/frontend.cpp | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/mythtv/programs/mythfrontend/services/frontend.cpp b/mythtv/programs/mythfrontend/services/frontend.cpp index bed8ccfbe81..cddee02c2b9 100644 --- a/mythtv/programs/mythfrontend/services/frontend.cpp +++ b/mythtv/programs/mythfrontend/services/frontend.cpp @@ -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()) From aa039e280105a529a24b5bbffb77b2a396ed5ea4 Mon Sep 17 00:00:00 2001 From: Justin Randall <2840408+JRRandall@users.noreply.github.com> Date: Fri, 26 Oct 2018 10:42:03 -0400 Subject: [PATCH 2/5] Added support for PlayLiveTV in frontend API --- mythtv/programs/mythfrontend/services/frontend.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mythtv/programs/mythfrontend/services/frontend.h b/mythtv/programs/mythfrontend/services/frontend.h index 5eafcb79dfb..4f9a20a6ae1 100644 --- a/mythtv/programs/mythfrontend/services/frontend.h +++ b/mythtv/programs/mythfrontend/services/frontend.h @@ -36,6 +36,7 @@ class Frontend : public FrontendServices uint Width, uint Height); virtual bool PlayRecording(int RecordedId, int ChanId, const QDateTime &StartTime); + bool PlayLiveTV(int ChanId); bool PlayVideo(const QString &Id, bool UseBookmark); QStringList GetContextList(void); DTC::FrontendActionList* GetActionList(const QString &Context); From eea0ffc66ebf4a761c5874a91bd2eb59c47389ee Mon Sep 17 00:00:00 2001 From: Justin Randall <2840408+JRRandall@users.noreply.github.com> Date: Fri, 26 Oct 2018 10:44:16 -0400 Subject: [PATCH 3/5] Added support for PlayLiveTV in frontend API --- mythtv/libs/libmythservicecontracts/services/frontendServices.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mythtv/libs/libmythservicecontracts/services/frontendServices.h b/mythtv/libs/libmythservicecontracts/services/frontendServices.h index a0844b8817a..1f148e7e245 100644 --- a/mythtv/libs/libmythservicecontracts/services/frontendServices.h +++ b/mythtv/libs/libmythservicecontracts/services/frontendServices.h @@ -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" ) @@ -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; From ed9e3829e7c799ed5c7a6659f8337d2a0df9f329 Mon Sep 17 00:00:00 2001 From: Justin Randall <2840408+JRRandall@users.noreply.github.com> Date: Tue, 7 May 2019 13:05:20 -0400 Subject: [PATCH 4/5] Resolving conflicts from previous pull request. --- .../programs/mythfrontend/services/frontend.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mythtv/programs/mythfrontend/services/frontend.h b/mythtv/programs/mythfrontend/services/frontend.h index 4f9a20a6ae1..95cd86d89bf 100644 --- a/mythtv/programs/mythfrontend/services/frontend.h +++ b/mythtv/programs/mythfrontend/services/frontend.h @@ -15,9 +15,9 @@ class Frontend : public FrontendServices Q_INVOKABLE explicit Frontend(QObject *parent = nullptr) : FrontendServices(parent) { } public: - DTC::FrontendStatus* GetStatus(void); + DTC::FrontendStatus* GetStatus(void) override; // FrontendServices bool SendMessage(const QString &Message, - uint Timeout); + uint Timeout) override; // FrontendServices bool SendNotification(bool Error, const QString &Type, const QString &Message, @@ -29,22 +29,22 @@ class Frontend : public FrontendServices float Progress, int Timeout, bool Fullscreen, - uint Visibility, uint Priority); + uint Visibility, uint Priority) override; // FrontendServices bool SendAction(const QString &Action, const QString &Value, - uint Width, uint Height); + uint Width, uint Height) override; // FrontendServices virtual bool PlayRecording(int RecordedId, int ChanId, - const QDateTime &StartTime); - bool PlayLiveTV(int ChanId); - bool PlayVideo(const QString &Id, bool UseBookmark); - QStringList GetContextList(void); - DTC::FrontendActionList* GetActionList(const QString &Context); + 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 static bool IsValidAction(const QString &action); static void InitialiseActions(void); - bool SendKey(const QString &Key); + bool SendKey(const QString &Key) override; // FrontendServices protected: static QStringList gActionList; From 28dd971aadf5217670f203d25137bc18e4ee697f Mon Sep 17 00:00:00 2001 From: Justin Randall <2840408+JRRandall@users.noreply.github.com> Date: Tue, 7 May 2019 13:11:08 -0400 Subject: [PATCH 5/5] Resolving conflicts for pull request --- mythtv/programs/mythfrontend/services/frontend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythtv/programs/mythfrontend/services/frontend.h b/mythtv/programs/mythfrontend/services/frontend.h index 95cd86d89bf..309972fe77a 100644 --- a/mythtv/programs/mythfrontend/services/frontend.h +++ b/mythtv/programs/mythfrontend/services/frontend.h @@ -34,7 +34,7 @@ class Frontend : public FrontendServices bool SendAction(const QString &Action, const QString &Value, uint Width, uint Height) override; // FrontendServices - virtual bool PlayRecording(int RecordedId, int ChanId, + 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