Skip to content

Commit 77096d5

Browse files
committed
Move default value for --outputfile into commandlineparser. Add back
support for defining a recording using --file, rather than only --chanid/--starttime.
1 parent f6a58df commit 77096d5

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

mythtv/programs/mythcommflag/commandlineparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void MythCommFlagCommandLineParser::LoadArguments(void)
4242
add("--force", "force", false, "Force operation, even if program appears to be in use.", "");
4343
add("--dontwritetodb", "dontwritedb", false, "", "Intended for external 3rd party use.");
4444
add("--onlydumpdb", "dumpdb", false, "", "?");
45-
add("--outputfile", "outputfile", "", "File to write commercial flagging output [debug].", "");
45+
add("--outputfile", "outputfile", "-", "File to write commercial flagging output [debug].", "");
4646
add("--dry-run", "dryrun", false, "Don't actually queue operation, just list what would be done", "");
4747
}
4848

mythtv/programs/mythcommflag/main.cpp

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,8 @@ int main(int argc, char *argv[])
11931193
else if (cmdline.toBool("rebuild"))
11941194
result = RebuildSeekTable(chanid, starttime, -1);
11951195
else
1196-
result = FlagCommercials(chanid, starttime, -1, "");
1196+
result = FlagCommercials(chanid, starttime, -1,
1197+
cmdline.toString("outputfile"));
11971198
}
11981199
else if (cmdline.toBool("jobid"))
11991200
{
@@ -1243,22 +1244,36 @@ int main(int argc, char *argv[])
12431244
}
12441245
else if (cmdline.toBool("file"))
12451246
{
1246-
// TODO: add back handling of recording defined by the basename
1247-
if (cmdline.toBool("rebuild"))
1247+
if (cmdline.toBool("skipdb"))
12481248
{
1249-
cerr << "You can no longer use --file with --rebuild. Please "
1250-
"use --chanid and " << endl
1251-
<< "--starttime" << endl;
1252-
return GENERIC_EXIT_INVALID_CMDLINE;
1253-
}
1254-
1255-
QString outputfile = cmdline.toString("outputfile");
1256-
if (outputfile.isEmpty() && cmdline.toBool("skipdb"))
1257-
outputfile = "-";
1249+
if (cmdline.toBool("rebuild"))
1250+
{
1251+
cerr << "The --rebuild parameter builds the seektable for "
1252+
"internal MythTV use only. It cannot be used in "
1253+
"combination with --skipdb." << endl;
1254+
return GENERIC_EXIT_INVALID_CMDLINE;
1255+
}
12581256

1259-
// perform commercial flagging on file outside the database
1260-
FlagCommercials(cmdline.toString("file"), -1, outputfile,
1261-
!cmdline.toBool("skipdb"));
1257+
// perform commercial flagging on file outside the database
1258+
FlagCommercials(cmdline.toString("file"), -1,
1259+
cmdline.toString("outputfile"),
1260+
!cmdline.toBool("skipdb"));
1261+
}
1262+
else
1263+
{
1264+
ProgramInfo pginfo(cmdline.toString("file"));
1265+
// pass chanid and starttime
1266+
// inefficient, but it lets the other function
1267+
// handle sanity checking
1268+
if (cmdline.toBool("rebuild"))
1269+
result = RebuildSeekTable(pginfo.GetChanID(),
1270+
pginfo.GetRecordingStartTime(),
1271+
-1);
1272+
else
1273+
result = FlagCommercials(pginfo.GetChanID(),
1274+
pginfo.GetRecordingStartTime(),
1275+
-1, cmdline.toString("outputfile"));
1276+
}
12621277
}
12631278
else if (cmdline.toBool("queue"))
12641279
{

0 commit comments

Comments
 (0)