+ switch (_resolution) {
+ case RESOLUTION_2K:
+ return libdcp::Size (2048, 1080);
+ case RESOLUTION_4K:
+ return libdcp::Size (4096, 2160);
+ }
+
+ assert (false);
+ return libdcp::Size ();
+}
+
+libdcp::KDM
+Film::make_kdm (
+ shared_ptr<libdcp::Certificate> target,
+ boost::filesystem::path dcp_dir,
+ boost::posix_time::ptime from,
+ boost::posix_time::ptime until
+ ) const
+{
+ shared_ptr<const Signer> signer = make_signer ();
+
+ libdcp::DCP dcp (dir (dcp_dir.string ()));
+
+ try {
+ dcp.read ();
+ } catch (...) {
+ throw KDMError (_("Could not read DCP to make KDM for"));
+ }
+
+ time_t now = time (0);
+ struct tm* tm = localtime (&now);
+ string const issue_date = libdcp::tm_to_string (tm);
+
+ dcp.cpls().front()->set_mxf_keys (key ());
+
+ return libdcp::KDM (dcp.cpls().front(), signer, target, from, until, "DCP-o-matic", issue_date);
+}
+
+list<libdcp::KDM>
+Film::make_kdms (
+ list<shared_ptr<Screen> > screens,
+ boost::filesystem::path dcp,
+ boost::posix_time::ptime from,
+ boost::posix_time::ptime until
+ ) const
+{
+ list<libdcp::KDM> kdms;
+
+ for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) {
+ kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until));
+ }
+
+ return kdms;