summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-09-24 22:55:17 +0100
committerCarl Hetherington <cth@carlh.net>2013-09-24 22:55:17 +0100
commit07cab16dec83785163e09d668e10692cd8abed0d (patch)
treec094bc2f50ade809ccfaca9866f8c5058f240075 /src/lib
parent089b90439e745a218494e76b45e7df6215af01df (diff)
Fix libdcp API changes; fix failure to reload cinema/screen configuration.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cinema.cc12
-rw-r--r--src/lib/cinema.h2
-rw-r--r--src/lib/config.cc7
-rw-r--r--src/lib/film.cc12
4 files changed, 27 insertions, 6 deletions
diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc
index 7af4372f5..eccd46b84 100644
--- a/src/lib/cinema.cc
+++ b/src/lib/cinema.cc
@@ -25,10 +25,18 @@ using std::list;
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)));
diff --git a/src/lib/cinema.h b/src/lib/cinema.h
index 251bb5d61..40dc15ae0 100644
--- a/src/lib/cinema.h
+++ b/src/lib/cinema.h
@@ -53,6 +53,8 @@ public:
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>);
diff --git a/src/lib/config.cc b/src/lib/config.cc
index a72e1a9e4..9d2d9d1bf 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -132,7 +132,12 @@ Config::read ()
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);
}
}
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 07af46d97..069be9b98 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -34,6 +34,8 @@
#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"
@@ -955,14 +957,18 @@ Film::make_kdms (
} 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);
}
}