summaryrefslogtreecommitdiff
path: root/src/lib/cinema_kdms.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-05-04 23:30:23 +0200
committerCarl Hetherington <cth@carlh.net>2020-05-06 20:15:16 +0200
commit4e62980064496060af5a8c6ecab26ddf218aa63a (patch)
treef3cc59c341866280e7998e7599039054a880d6b0 /src/lib/cinema_kdms.cc
parentca56871d4860b8ead384c410fe374c2fa993f88f (diff)
Remove Screen pointer from KDMWithMetadata, preferring to
add metadata to a dcp::NameFormat::Map earlier in the call stack.
Diffstat (limited to 'src/lib/cinema_kdms.cc')
-rw-r--r--src/lib/cinema_kdms.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc
index 61234ff3f..56b76d3f9 100644
--- a/src/lib/cinema_kdms.cc
+++ b/src/lib/cinema_kdms.cc
@@ -29,6 +29,7 @@
#include "log.h"
#include "zipper.h"
#include "dcpomatic_log.h"
+#include "kdm_with_metadata.h"
#include <boost/foreach.hpp>
#include "i18n.h"
@@ -39,6 +40,7 @@ using std::string;
using std::runtime_error;
using boost::shared_ptr;
using boost::function;
+using boost::optional;
void
CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat name_format, dcp::NameFormat::Map name_values) const
@@ -48,7 +50,6 @@ CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat nam
name_values['c'] = cinema->name;
BOOST_FOREACH (KDMWithMetadataPtr i, screen_kdms) {
- name_values['s'] = i->screen->name;
name_values['i'] = i->kdm_id ();
string const name = careful_string_filter(name_format.get(name_values, ".xml"));
zipper.add (name, i->kdm_as_xml());
@@ -72,14 +73,14 @@ CinemaKDMs::collect (list<KDMWithMetadataPtr> screen_kdms)
CinemaKDMs ck;
list<KDMWithMetadataPtr>::iterator i = screen_kdms.begin ();
- ck.cinema = (*i)->screen->cinema;
+ ck.cinema = (*i)->cinema();
ck.screen_kdms.push_back (*i);
list<KDMWithMetadataPtr>::iterator j = i;
++i;
screen_kdms.remove (*j);
while (i != screen_kdms.end ()) {
- if ((*i)->screen->cinema == ck.cinema) {
+ if ((*i)->cinema() == ck.cinema) {
ck.screen_kdms.push_back (*i);
list<KDMWithMetadataPtr>::iterator j = i;
++i;
@@ -210,7 +211,10 @@ CinemaKDMs::email (
string screens;
BOOST_FOREACH (KDMWithMetadataPtr j, i.screen_kdms) {
- screens += j->screen->name + ", ";
+ optional<string> screen_name = j->get('n');
+ if (screen_name) {
+ screens += *screen_name + ", ";
+ }
}
boost::algorithm::replace_all (body, "$SCREENS", screens.substr (0, screens.length() - 2));