From f9a15718a824a8fddf4f56b64c8880b1a5544aa3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 1 Nov 2021 16:44:10 +0100 Subject: [PATCH] Send emails in the CLI KDM tool (#2113). --- src/tools/dcpomatic_kdm_cli.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index 45d93436e..26444abf0 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -70,6 +70,7 @@ help () " -F, --formulation modified-transitional-1, multiple-modified-transitional-1, dci-any or dci-specific [default modified-transitional-1]\n" " -p, --disable-forensic-marking-picture disable forensic marking of pictures essences\n" " -a, --disable-forensic-marking-audio disable forensic marking of audio essences (optionally above a given channel, e.g 12)\n" + " -e, --email email KDMs to cinemas\n" " -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" @@ -210,6 +211,7 @@ from_film ( dcp::Formulation formulation, bool disable_forensic_marking_picture, optional disable_forensic_marking_audio, + bool email, bool zip ) { @@ -244,6 +246,9 @@ from_film ( } } write_files (kdms, zip, output, container_name_format, filename_format, verbose); + if (email) { + send_emails ({kdms}, container_name_format, filename_format, film->dcp_name()); + } } catch (FileError& e) { cerr << program_name << ": " << e.what() << " (" << e.file().string() << ")\n"; exit (EXIT_FAILURE); @@ -335,6 +340,7 @@ from_dkdm ( dcp::Formulation formulation, bool disable_forensic_marking_picture, optional disable_forensic_marking_audio, + bool email, bool zip ) { @@ -372,12 +378,18 @@ from_dkdm ( kdms.push_back (make_shared(name_values, i->cinema.get(), i->cinema->emails, kdm)); } write_files (kdms, zip, output, container_name_format, filename_format, verbose); + if (email) { + send_emails ({kdms}, container_name_format, filename_format, dkdm.annotation_text().get_value_or("")); + } } catch (FileError& e) { cerr << program_name << ": " << e.what() << " (" << e.file().string() << ")\n"; exit (EXIT_FAILURE); } catch (KDMError& e) { cerr << program_name << ": " << e.what() << "\n"; exit (EXIT_FAILURE); + } catch (NetworkError& e) { + cerr << program_name << ": " << e.what() << "\n"; + exit (EXIT_FAILURE); } } @@ -427,6 +439,7 @@ int main (int argc, char* argv[]) dcp::Formulation formulation = dcp::Formulation::MODIFIED_TRANSITIONAL_1; bool disable_forensic_marking_picture = false; optional disable_forensic_marking_audio; + bool email = false; program_name = argv[0]; @@ -443,6 +456,7 @@ int main (int argc, char* argv[]) { "formulation", required_argument, 0, 'F' }, { "disable-forensic-marking-picture", no_argument, 0, 'p' }, { "disable-forensic-marking-audio", optional_argument, 0, 'a' }, + { "email", no_argument, 0, 'e' }, { "zip", no_argument, 0, 'z' }, { "verbose", no_argument, 0, 'v' }, { "cinema", required_argument, 0, 'c' }, @@ -454,7 +468,7 @@ int main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "ho:K:Z:f:t:d:F:pa::zvc:S:C:T:BD", long_options, &option_index); + int c = getopt_long (argc, argv, "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BD", long_options, &option_index); if (c == -1) { break; @@ -506,6 +520,9 @@ int main (int argc, char* argv[]) disable_forensic_marking_audio = atoi (optarg); } break; + case 'e': + email = true; + break; case 'z': zip = true; break; @@ -609,6 +626,7 @@ int main (int argc, char* argv[]) formulation, disable_forensic_marking_picture, disable_forensic_marking_audio, + email, zip ); } else { @@ -634,6 +652,7 @@ int main (int argc, char* argv[]) formulation, disable_forensic_marking_picture, disable_forensic_marking_audio, + email, zip ); } -- 2.30.2