diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-12-30 23:07:12 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-12-30 23:07:12 +0000 |
| commit | 37b3b2e32e21a0bcc1b0c718f5e6d5ebbe80a5bb (patch) | |
| tree | bed46101a9194a542d82a210b3c55d794e948f12 /src/tools/dcpomatic_kdm_cli.cc | |
| parent | ddc12bfa6d287a7b434f012333e2ea0d4bacb92c (diff) | |
More refactoring.
Diffstat (limited to 'src/tools/dcpomatic_kdm_cli.cc')
| -rw-r--r-- | src/tools/dcpomatic_kdm_cli.cc | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index df2e1a8e2..6fa7863bf 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -141,6 +141,27 @@ write_files (list<ScreenKDM> screen_kdms, bool zip, boost::filesystem::path outp } } +shared_ptr<Cinema> +find_cinema (string cinema_name) +{ + list<shared_ptr<Cinema> > cinemas = Config::instance()->cinemas (); + list<shared_ptr<Cinema> >::const_iterator i = cinemas.begin(); + while ( + i != cinemas.end() && + (*i)->name != cinema_name && + find ((*i)->emails.begin(), (*i)->emails.end(), cinema_name) == (*i)->emails.end()) { + + ++i; + } + + if (i == cinemas.end ()) { + cerr << program_name << ": could not find cinema \"" << cinema_name << "\"\n"; + exit (EXIT_FAILURE); + } + + return *i; +} + int main (int argc, char* argv[]) { boost::filesystem::path output; @@ -300,21 +321,6 @@ int main (int argc, char* argv[]) } } else { - list<shared_ptr<Cinema> > cinemas = Config::instance()->cinemas (); - list<shared_ptr<Cinema> >::const_iterator i = cinemas.begin(); - while ( - i != cinemas.end() && - (*i)->name != cinema_name && - find ((*i)->emails.begin(), (*i)->emails.end(), cinema_name) == (*i)->emails.end()) { - - ++i; - } - - if (i == cinemas.end ()) { - cerr << program_name << ": could not find cinema \"" << cinema_name << "\"\n"; - exit (EXIT_FAILURE); - } - if (output.empty ()) { output = "."; } @@ -326,7 +332,7 @@ int main (int argc, char* argv[]) try { list<ScreenKDM> screen_kdms = film->make_kdms ( - (*i)->screens(), cpl, valid_from.get(), valid_to.get(), formulation + find_cinema(cinema_name)->screens(), cpl, valid_from.get(), valid_to.get(), formulation ); write_files (screen_kdms, zip, output, values, verbose); |
