summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-03-07 10:18:31 +0000
committerCarl Hetherington <cth@carlh.net>2017-03-07 10:18:31 +0000
commite340b96b4a33725e70e3703b0c60ba8da95bca3b (patch)
treebddbe1231a7417f872d19c9bf77e500db45bb0d0 /src/tools
parent443a7d74ff2a49ad45a4fb44f92abd619bc0a0b0 (diff)
parente4d7f575fab50b6d255821d6d6a8171c8e1f13f6 (diff)
Merge.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc13
-rw-r--r--src/tools/dcpomatic_kdm.cc51
-rw-r--r--src/tools/dcpomatic_kdm_cli.cc12
3 files changed, 36 insertions, 40 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index d091512a0..92de9a1f0 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -61,6 +61,7 @@
#include "lib/cinema_kdms.h"
#include "lib/dcpomatic_socket.h"
#include "lib/hints.h"
+#include "lib/dcp_content.h"
#include <dcp/exceptions.h>
#include <dcp/raw_convert.h>
#include <wx/generic/aboutdlgg.h>
@@ -1029,7 +1030,8 @@ private:
static const wxCmdLineEntryDesc command_line_description[] = {
{ wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
- { wxCMD_LINE_OPTION, "c", "content", "add content file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
+ { wxCMD_LINE_OPTION, "c", "content", "add content file / directory", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
+ { wxCMD_LINE_OPTION, "d", "dcp", "add content DCP", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
};
@@ -1127,6 +1129,9 @@ private:
_frame->film()->examine_and_add_content (i);
}
}
+ if (!_dcp_to_add.empty ()) {
+ _frame->film()->examine_and_add_content (shared_ptr<DCPContent> (new DCPContent (_frame->film(), _dcp_to_add)));
+ }
}
signal_manager = new wxSignalManager (this);
@@ -1169,6 +1174,11 @@ private:
_content_to_add = wx_to_std (content);
}
+ wxString dcp;
+ if (parser.Found (wxT ("dcp"), &dcp)) {
+ _dcp_to_add = wx_to_std (dcp);
+ }
+
return true;
}
@@ -1235,6 +1245,7 @@ private:
string _film_to_load;
string _film_to_create;
string _content_to_add;
+ string _dcp_to_add;
};
IMPLEMENT_APP (App)
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 880aec454..e79448be7 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2017 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -60,6 +60,7 @@ using std::exception;
using std::list;
using std::string;
using std::vector;
+using std::pair;
using boost::shared_ptr;
using boost::bind;
using boost::optional;
@@ -318,46 +319,28 @@ private:
screen_kdms.push_back (ScreenKDM (i, kdm.encrypt (signer, i->recipient.get(), i->trusted_devices, _output->formulation())));
}
- dcp::NameFormat::Map name_values;
- name_values['f'] = decrypted.content_title_text();
- name_values['b'] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
- name_values['e'] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
-
- if (_output->write_to()) {
- int written = ScreenKDM::write_files (
- screen_kdms, _output->directory(), _output->name_format(), name_values,
- bind (&DOMFrame::confirm_overwrite, this, _1)
- );
+ pair<shared_ptr<Job>, int> result = _output->make (
+ screen_kdms, decrypted.content_title_text(), _timing, bind (&DOMFrame::confirm_overwrite, this, _1), shared_ptr<Log> ()
+ );
- if (written > 0) {
- /* XXX: proper plural form support in wxWidgets? */
- wxString s = written == 1 ? _("%d KDM written to %s") : _("%d KDMs written to %s");
- message_dialog (
- this,
- wxString::Format (s, written, std_to_wx(_output->directory().string()).data())
- );
- }
- } else {
- string film_name = decrypted.annotation_text().get_value_or ("");
- if (film_name.empty ()) {
- film_name = decrypted.content_title_text ();
- }
- shared_ptr<Job> job (new SendKDMEmailJob (
- CinemaKDMs::collect (screen_kdms),
- _output->name_format(),
- name_values,
- decrypted.content_title_text(),
- shared_ptr<Log> ()
- ));
-
- JobManager::instance()->add (job);
+ if (result.first) {
+ JobManager::instance()->add (result.first);
if (_job_view) {
_job_view->Destroy ();
_job_view = 0;
}
- _job_view = new JobViewDialog (this, _("Send KDM emails"), job);
+ _job_view = new JobViewDialog (this, _("Send KDM emails"), result.first);
_job_view->ShowModal ();
}
+
+ if (result.second > 0) {
+ /* XXX: proper plural form support in wxWidgets? */
+ wxString s = result.second == 1 ? _("%d KDM written to %s") : _("%d KDMs written to %s");
+ message_dialog (
+ this,
+ wxString::Format (s, result.second, std_to_wx(_output->directory().string()).data())
+ );
+ }
} catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc
index 7cfcaa171..e06b9844b 100644
--- a/src/tools/dcpomatic_kdm_cli.cc
+++ b/src/tools/dcpomatic_kdm_cli.cc
@@ -302,24 +302,26 @@ int main (int argc, char* argv[])
);
if (zip) {
- CinemaKDMs::write_zip_files (
+ int const N = CinemaKDMs::write_zip_files (
CinemaKDMs::collect (screen_kdms),
output,
+ Config::instance()->kdm_container_name_format(),
Config::instance()->kdm_filename_format(),
- values
+ values,
+ bind (&always_overwrite)
);
if (verbose) {
- cout << "Wrote ZIP files to " << output << "\n";
+ cout << "Wrote " << N << " ZIP files to " << output << "\n";
}
} else {
- ScreenKDM::write_files (
+ int const N = ScreenKDM::write_files (
screen_kdms, output, Config::instance()->kdm_filename_format(), values,
bind (&always_overwrite)
);
if (verbose) {
- cout << "Wrote KDM files to " << output << "\n";
+ cout << "Wrote " << N << " KDM files to " << output << "\n";
}
}
} catch (FileError& e) {