-CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat name_format, dcp::NameFormat::Map name_values) const
+make_zip_file (list<KDMWithMetadataPtr> kdms, boost::filesystem::path zip_file, dcp::NameFormat name_format, dcp::NameFormat::Map name_values)
- name_values['c'] = cinema->name;
-
- BOOST_FOREACH (shared_ptr<KDMWithMetadata> i, screen_kdms) {
- name_values['s'] = i->screen->name;
+ BOOST_FOREACH (KDMWithMetadataPtr i, kdms) {
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());
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());
- list<shared_ptr<KDMWithMetadata> >::iterator i = screen_kdms.begin ();
- ck.cinema = (*i)->screen->cinema;
- ck.screen_kdms.push_back (*i);
- list<shared_ptr<KDMWithMetadata> >::iterator j = i;
+ list<KDMWithMetadataPtr>::iterator i = screen_kdms.begin ();
+ ck.push_back (*i);
+ list<KDMWithMetadataPtr>::iterator j = i;
- if ((*i)->screen->cinema == ck.cinema) {
- ck.screen_kdms.push_back (*i);
- list<shared_ptr<KDMWithMetadata> >::iterator j = i;
+ if ((*i)->cinema() == ck.front()->cinema()) {
+ ck.push_back (*i);
+ list<KDMWithMetadataPtr>::iterator j = i;
boost::filesystem::path directory,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
boost::filesystem::path directory,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
path /= container_name_format.get(name_values, "");
if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
boost::filesystem::create_directories (path);
path /= container_name_format.get(name_values, "");
if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
boost::filesystem::create_directories (path);
- KDMWithMetadata::write_files (i.screen_kdms, path, filename_format, name_values, confirm_overwrite);
+ write_files (i, path, filename_format, name_values, confirm_overwrite);
boost::filesystem::path directory,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
boost::filesystem::path directory,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
path /= container_name_format.get(name_values, ".zip");
if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
if (boost::filesystem::exists (path)) {
/* Creating a new zip file over an existing one is an error */
boost::filesystem::remove (path);
}
path /= container_name_format.get(name_values, ".zip");
if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
if (boost::filesystem::exists (path)) {
/* Creating a new zip file over an existing one is an error */
boost::filesystem::remove (path);
}
- i.make_zip_file (path, filename_format, name_values);
- written += i.screen_kdms.size();
+ make_zip_file (i, path, filename_format, name_values);
+ written += i.size();
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
dcp::NameFormat::Map name_values,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
dcp::NameFormat::Map name_values,
boost::filesystem::path zip_file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
boost::filesystem::create_directories (zip_file);
zip_file /= container_name_format.get(name_values, ".zip");
boost::filesystem::path zip_file = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
boost::filesystem::create_directories (zip_file);
zip_file /= container_name_format.get(name_values, ".zip");
- i.make_zip_file (zip_file, filename_format, name_values);
+ make_zip_file (i, zip_file, filename_format, name_values);
string subject = config->kdm_subject();
boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
boost::algorithm::replace_all (subject, "$START_TIME", name_values['b']);
boost::algorithm::replace_all (subject, "$END_TIME", name_values['e']);
string subject = config->kdm_subject();
boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
boost::algorithm::replace_all (subject, "$START_TIME", name_values['b']);
boost::algorithm::replace_all (subject, "$END_TIME", name_values['e']);
string body = config->kdm_email().c_str();
boost::algorithm::replace_all (body, "$CPL_NAME", cpl_name);
boost::algorithm::replace_all (body, "$START_TIME", name_values['b']);
boost::algorithm::replace_all (body, "$END_TIME", name_values['e']);
string body = config->kdm_email().c_str();
boost::algorithm::replace_all (body, "$CPL_NAME", cpl_name);
boost::algorithm::replace_all (body, "$START_TIME", name_values['b']);
boost::algorithm::replace_all (body, "$END_TIME", name_values['e']);
- BOOST_FOREACH (shared_ptr<KDMWithMetadata> j, i.screen_kdms) {
- screens += j->screen->name + ", ";
+ BOOST_FOREACH (KDMWithMetadataPtr j, i) {
+ 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));
}
boost::algorithm::replace_all (body, "$SCREENS", screens.substr (0, screens.length() - 2));
- Emailer email (config->kdm_from(), i.cinema->emails, subject, body);
+ Emailer email (config->kdm_from(), i.front()->cinema()->emails, subject, body);