diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-14 23:10:45 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-14 23:28:26 +0000 |
| commit | 85d72a25071f7b5a5d93a2d91f245b0cc7ffbe3b (patch) | |
| tree | b30b1b31507d837a86cdc4336a7642a6fff9f9ae /src/tools/dcpomatic_kdm_cli.cc | |
| parent | 3cf01b5a9a8312981af2fb432f6c717b1a17c137 (diff) | |
Tidy up option parsing a little.
Diffstat (limited to 'src/tools/dcpomatic_kdm_cli.cc')
| -rw-r--r-- | src/tools/dcpomatic_kdm_cli.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index 055170441..fbd6bb870 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -390,7 +390,6 @@ int main (int argc, char* argv[]) shared_ptr<Cinema> cinema; string screen_description = ""; list<shared_ptr<Screen> > screens; - optional<dcp::Certificate> certificate; optional<dcp::EncryptedKDM> dkdm; optional<boost::posix_time::ptime> valid_from; optional<boost::posix_time::ptime> valid_to; @@ -488,25 +487,29 @@ int main (int argc, char* argv[]) verbose = true; break; case 'c': + /* This could be a cinema to search for in the configured list or the name of a cinema being + built up on-the-fly in the option. Cater for both possilibities here by storing the name + (for lookup) and by creating a Cinema which the next Screen will be added to. + */ cinema_name = optarg; - cinema = shared_ptr<Cinema> (new Cinema (cinema_name, list<string>(), "", 0, 0)); + cinema = shared_ptr<Cinema> (new Cinema (optarg, list<string>(), "", 0, 0)); break; case 'S': screen_description = optarg; break; case 'C': - { - certificate = dcp::Certificate (dcp::file_to_string (optarg)); - vector<dcp::Certificate> trusted_devices; - shared_ptr<Screen> screen (new Screen (screen_description, certificate, trusted_devices)); + /* Make a new screen and add it to the current cinema */ + shared_ptr<Screen> screen (new Screen (screen_description, dcp::Certificate (dcp::file_to_string (optarg)), vector<dcp::Certificate>())); if (cinema) { cinema->add_screen (screen); } screens.push_back (screen); break; - } case 'T': - screens.back()->trusted_devices.push_back (dcp::Certificate (dcp::file_to_string (optarg))); + /* A trusted device ends up in the last screen we made */ + if (!screens.empty ()) { + screens.back()->trusted_devices.push_back (dcp::Certificate (dcp::file_to_string (optarg))); + } break; case 'B': list_cinemas = true; |
