using boost::shared_ptr;
Cinema::Cinema (shared_ptr<const cxml::Node> node)
+ : name (node->string_child ("Name"))
+ , email (node->string_child ("Email"))
{
- name = node->string_child ("Name");
- email = node->string_child ("Email");
+}
+
+/* This is necessary so that we can use shared_from_this in add_screen (which cannot be done from
+ a constructor)
+*/
+void
+Cinema::read_screens (shared_ptr<const cxml::Node> node)
+{
list<shared_ptr<cxml::Node> > s = node->node_children ("Screen");
for (list<shared_ptr<cxml::Node> >::iterator i = s.begin(); i != s.end(); ++i) {
add_screen (shared_ptr<Screen> (new Screen (*i)));
Cinema (boost::shared_ptr<const cxml::Node>);
+ void read_screens (boost::shared_ptr<const cxml::Node>);
+
void as_xml (xmlpp::Element *) const;
void add_screen (boost::shared_ptr<Screen>);
list<shared_ptr<cxml::Node> > cin = f.node_children ("Cinema");
for (list<shared_ptr<cxml::Node> >::iterator i = cin.begin(); i != cin.end(); ++i) {
- _cinemas.push_back (shared_ptr<Cinema> (new Cinema (*i)));
+ /* Slightly grotty two-part construction of Cinema here so that we can use
+ shared_from_this.
+ */
+ shared_ptr<Cinema> cinema (new Cinema (*i));
+ cinema->read_screens (*i);
+ _cinemas.push_back (cinema);
}
}
#include <libdcp/signer_chain.h>
#include <libdcp/cpl.h>
#include <libdcp/signer.h>
+#include <libdcp/util.h>
+#include <libdcp/kdm.h>
#include "film.h"
#include "job.h"
#include "util.h"
} 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);
- shared_ptr<xmlpp::Document> kdm = dcp.cpls().front()->make_kdm (
- signer, (*i)->certificate, key (), from, until, _interop, libdcp::MXFMetadata (), Config::instance()->dcp_metadata ()
+ libdcp::KDM kdm (
+ dcp.cpls().front(), signer, (*i)->certificate, from, until, "DCP-o-matic", issue_date
);
boost::filesystem::path out = directory;
out /= tidy_for_filename ((*i)->cinema->name) + "_" + tidy_for_filename ((*i)->name) + ".kdm.xml";
- kdm->write_to_file_formatted (out.string());
+ kdm.as_xml (out);
}
}