Skip to content

Commit

Permalink
mythexternrec: Track channum so an unnecessary tune is not issued on …
Browse files Browse the repository at this point in the history
…back-to-back recordings.
  • Loading branch information
jpoet committed Apr 3, 2020
1 parent d5dacff commit d8d3b74
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions mythtv/programs/mythexternrecorder/MythExternRecApp.cpp
Expand Up @@ -260,6 +260,8 @@ void MythExternRecApp::Run(void)

Q_SLOT void MythExternRecApp::Cleanup(void)
{
m_tunedChannel.clear();

if (m_cleanup.isEmpty())
return;

Expand All @@ -272,7 +274,8 @@ Q_SLOT void MythExternRecApp::Cleanup(void)
cleanup.start(cmd);
if (!cleanup.waitForStarted())
{
LOG(VB_RECORD, LOG_ERR, LOC + ": Failed to start cleanup process: " + ENO);
LOG(VB_RECORD, LOG_ERR, LOC + ": Failed to start cleanup process: "
+ ENO);
return;
}
cleanup.waitForFinished(5000);
Expand Down Expand Up @@ -412,6 +415,15 @@ Q_SLOT void MythExternRecApp::NextChannel(const QString & serial)
Q_SLOT void MythExternRecApp::TuneChannel(const QString & serial,
const QString & channum)
{
if (m_tunedChannel == channum)
{
LOG(VB_CHANNEL, LOG_INFO, LOC +
QString("TuneChanne: Already on %1").arg(channum));
emit SendMessage("TuneChannel", serial,
QString("OK:Tunned to %1").arg(channum));
return;
}

if (m_channelsIni.isEmpty())
{
LOG(VB_CHANNEL, LOG_ERR, LOC + ": No channels configured.");
Expand Down Expand Up @@ -489,7 +501,7 @@ Q_SLOT void MythExternRecApp::TuneChannel(const QString & serial,

LOG(VB_CHANNEL, LOG_INFO, LOC +
QString(": TuneChannel %1: URL '%2'").arg(channum).arg(url));
m_tuned = true;
m_tunedChannel = channum;

emit SetDescription(Desc());
emit SendMessage("TuneChannel", serial,
Expand Down Expand Up @@ -528,7 +540,7 @@ Q_SLOT void MythExternRecApp::SetBlockSize(const QString & serial, int blksz)
Q_SLOT void MythExternRecApp::StartStreaming(const QString & serial)
{
m_streaming = true;
if (!m_tuned && !m_channelsIni.isEmpty())
if (m_tunedChannel.isEmpty() && !m_channelsIni.isEmpty())
{
LOG(VB_RECORD, LOG_ERR, LOC + ": No channel has been tuned");
emit SendMessage("StartStreaming", serial,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythexternrecorder/MythExternRecApp.h
Expand Up @@ -117,7 +117,7 @@ class MythExternRecApp : public QObject
QString m_configIni;
QString m_desc;

bool m_tuned { false };
QString m_tunedChannel;

// Channel scanning
QSettings *m_chanSettings { nullptr };
Expand Down

0 comments on commit d8d3b74

Please sign in to comment.