From: Carl Hetherington Date: Sun, 31 Dec 2017 01:02:15 +0000 (+0000) Subject: Add option to dump known DKDM CPL IDs. X-Git-Tag: v2.11.32~6 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=a7ca445387d132cf2f23008c0859275733514602 Add option to dump known DKDM CPL IDs. --- diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index e6a96210b..5e75266ea 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -60,8 +60,9 @@ help () " -z, --zip ZIP each cinema's KDMs into its own file\n" " -v, --verbose be verbose\n" " -c, --cinema specify a cinema, either by name or email address\n" + " --certificate file containing projector certificate\n" " --cinemas list known cinemas from the DCP-o-matic settings\n" - " --certificate file containing projector certificate\n\n" + " --dkdm-cpls list CPLs for which DCP-o-matic has DKDMs\n\n" "CPL-ID must be the ID of a CPL that is mentioned in DCP-o-matic's DKDM list.\n\n" "For example:\n\n" "Create KDMs for my_great_movie to play in all of Fred's Cinema's screens for the next two weeks and zip them up.\n" @@ -379,6 +380,30 @@ from_dkdm ( } } +void +dump_dkdm_group (shared_ptr group, int indent) +{ + if (indent > 0) { + for (int i = 0; i < indent; ++i) { + cout << " "; + } + cout << group->name() << "\n"; + } + BOOST_FOREACH (shared_ptr i, group->children()) { + shared_ptr g = dynamic_pointer_cast(i); + if (g) { + dump_dkdm_group (g, indent + 2); + } else { + for (int i = 0; i < indent; ++i) { + cout << " "; + } + shared_ptr d = dynamic_pointer_cast(i); + assert(d); + cout << d->dkdm().cpl_id() << "\n"; + } + } +} + int main (int argc, char* argv[]) { optional output; @@ -388,6 +413,7 @@ int main (int argc, char* argv[]) bool zip = false; optional cinema_name; bool cinemas = false; + bool dkdm_cpls = false; optional duration_string; bool verbose = false; dcp::Formulation formulation = dcp::MODIFIED_TRANSITIONAL_1; @@ -404,6 +430,7 @@ int main (int argc, char* argv[]) { "certificate", required_argument, 0, 'A' }, { "cinema", required_argument, 0, 'c' }, { "cinemas", no_argument, 0, 'B' }, + { "dkdm-cpls", no_argument, 0, 'D' }, { "zip", no_argument, 0, 'z' }, { "duration", required_argument, 0, 'd' }, { "verbose", no_argument, 0, 'v' }, @@ -411,7 +438,7 @@ int main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "ho:f:t:c:A:Bzd:vC:", long_options, &option_index); + int c = getopt_long (argc, argv, "ho:f:t:c:A:Bzd:vC:D", long_options, &option_index); if (c == -1) { break; @@ -439,6 +466,9 @@ int main (int argc, char* argv[]) case 'B': cinemas = true; break; + case 'D': + dkdm_cpls = true; + break; case 'z': zip = true; break; @@ -469,6 +499,11 @@ int main (int argc, char* argv[]) exit (EXIT_SUCCESS); } + if (dkdm_cpls) { + dump_dkdm_group (Config::instance()->dkdms(), 0); + exit (EXIT_SUCCESS); + } + if (!duration_string && !valid_to) { error ("you must specify a --valid-duration or --valid-to"); }