Skip to content

Commit

Permalink
Fix some mythcommflag command line option handling.
Browse files Browse the repository at this point in the history
Honor the --outputmethod command line option and fix a bug in
the handling of the --commmethod.

Fixes #10989 using slightly tweaked patch by Bryan from mlewallpapers.
  • Loading branch information
cpinkham committed Jun 15, 2013
1 parent 4167259 commit 516a59d
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions mythtv/programs/mythcommflag/main.cpp
Expand Up @@ -737,8 +737,7 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid,
int breaksFound = 0;

// configure commercial detection method
SkipTypes commDetectMethod =
(enum SkipTypes)gCoreContext->GetNumSetting(
SkipTypes commDetectMethod = (SkipTypes)gCoreContext->GetNumSetting(
"CommercialSkipMethod", COMM_DETECT_ALL);

if (cmdline.toBool("commmethod"))
Expand Down Expand Up @@ -774,16 +773,19 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid,
return GENERIC_EXIT_INVALID_CMDLINE;
}

// append flag method to list
commDetectMethod = (SkipTypes) ((int)commDetectMethod
|| (int)skipTypes->value(val));
if (commDetectMethod == COMM_DETECT_UNINIT) {
commDetectMethod = (SkipTypes) skipTypes->value(val);
} else {
commDetectMethod = (SkipTypes) ((int)commDetectMethod
| (int)skipTypes->value(val));
}
}

}
if (commDetectMethod == COMM_DETECT_UNINIT)
return GENERIC_EXIT_INVALID_CMDLINE;
}
else if (!cmdline.toBool("skipdb"))
else if (useDB)
{
// if not manually specified, and we have a database to access
// pull the commflag type from the channel
Expand Down Expand Up @@ -823,9 +825,11 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid,
}

}
else if (cmdline.toBool("skipdb"))
else if (!useDB)
{
// 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 Expand Up @@ -1149,6 +1153,13 @@ int main(int argc, char *argv[])

MythTranslation::load("mythfrontend");

if (cmdline.toBool("outputmethod"))
{
QString om = cmdline.toString("outputmethod");
if (outputTypes->contains(om))
outputMethod = outputTypes->value(om);
}

if (cmdline.toBool("chanid") && cmdline.toBool("starttime"))
{
// operate on a recording in the database
Expand Down

0 comments on commit 516a59d

Please sign in to comment.