summaryrefslogtreecommitdiff
path: root/src/tools/dcpomatic_kdm_cli.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-12-31 01:02:15 +0000
committerCarl Hetherington <cth@carlh.net>2017-12-31 01:02:15 +0000
commita7ca445387d132cf2f23008c0859275733514602 (patch)
tree2978048a2c98f6dc0cad10720b80736dc200f24a /src/tools/dcpomatic_kdm_cli.cc
parentcfadb4cbf4bec6ac7ffed641764f5f4cea9667bc (diff)
Add option to dump known DKDM CPL IDs.
Diffstat (limited to 'src/tools/dcpomatic_kdm_cli.cc')
-rw-r--r--src/tools/dcpomatic_kdm_cli.cc39
1 files changed, 37 insertions, 2 deletions
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<DKDMGroup> group, int indent)
+{
+ if (indent > 0) {
+ for (int i = 0; i < indent; ++i) {
+ cout << " ";
+ }
+ cout << group->name() << "\n";
+ }
+ BOOST_FOREACH (shared_ptr<DKDMBase> i, group->children()) {
+ shared_ptr<DKDMGroup> g = dynamic_pointer_cast<DKDMGroup>(i);
+ if (g) {
+ dump_dkdm_group (g, indent + 2);
+ } else {
+ for (int i = 0; i < indent; ++i) {
+ cout << " ";
+ }
+ shared_ptr<DKDM> d = dynamic_pointer_cast<DKDM>(i);
+ assert(d);
+ cout << d->dkdm().cpl_id() << "\n";
+ }
+ }
+}
+
int main (int argc, char* argv[])
{
optional<boost::filesystem::path> output;
@@ -388,6 +413,7 @@ int main (int argc, char* argv[])
bool zip = false;
optional<string> cinema_name;
bool cinemas = false;
+ bool dkdm_cpls = false;
optional<string> 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");
}