Skip to content

Commit

Permalink
Add --dry-run option to mythcommflag to decide whether to actually
Browse files Browse the repository at this point in the history
--queue jobs in the queue, or just indicate which jobs would be queued.
  • Loading branch information
wagnerrp committed Jul 13, 2011
1 parent cba6ab1 commit 1cfa959
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions mythtv/programs/mythcommflag/commandlineparser.cpp
Expand Up @@ -43,5 +43,6 @@ void MythCommFlagCommandLineParser::LoadArguments(void)
add("--dontwritetodb", "dontwritedb", false, "", "Intended for external 3rd party use.");
add("--onlydumpdb", "dumpdb", false, "", "?");
add("--outputfile", "outputfile", "", "File to write commercial flagging output [debug].", "");
add("--dry-run", "dryrun", false, "Don't actually queue operation, just list what would be done", "");
}

16 changes: 13 additions & 3 deletions mythtv/programs/mythcommflag/main.cpp
Expand Up @@ -208,6 +208,14 @@ static int QueueCommFlagJob(uint chanid, QDateTime starttime, bool rebuild)
return GENERIC_EXIT_NO_RECORDING_DATA;
}

if (cmdline.toBool("dryrun"))
{
QString tmp = QString("Job have been queued for chanid %1 @ %2")
.arg(chanid).arg(startstring);
cerr << tmp.toLocal8Bit().constData() << endl;
return GENERIC_EXIT_OK;
}

bool result = JobQueue::QueueJob(JOB_COMMFLAG,
pginfo.GetChanID(), pginfo.GetRecordingStartTime(), "", "", "",
rebuild ? JOB_REBUILD : 0, JOB_QUEUED, QDateTime());
Expand Down Expand Up @@ -770,11 +778,10 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid,
(enum SkipTypes)gCoreContext->GetNumSetting(
"CommercialSkipMethod", COMM_DETECT_ALL);

if (cmdline.toBool("commmethod") || cmdline.toBool("skipdb"))
if (cmdline.toBool("commmethod"))
{
// pull commercial detection method from command line
QString commmethod = cmdline.toBool("commmethod") ?
cmdline.toString("commmethod") : "blank";
QString commmethod = cmdline.toString("commmethod");

// assume definition as integer value
bool ok = true;
Expand Down Expand Up @@ -853,6 +860,9 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid,
}

}
else if (cmdline.toBool("skipdb"))
// default to a cheaper method for debugging purposes
commDetectMethod = COMM_DETECT_BLANK;

// if selection has failed, or intentionally disabled, drop out
if (commDetectMethod == COMM_DETECT_UNINIT)
Expand Down

0 comments on commit 1cfa959

Please sign in to comment.