+/** Write one ZIP file per cinema into a directory */
+int
+CinemaKDMs::write_zip_files (
+ list<CinemaKDMs> cinema_kdms,
+ boost::filesystem::path directory,
+ dcp::NameFormat container_name_format,
+ dcp::NameFormat filename_format,
+ dcp::NameFormat::Map name_values,
+ function<bool (boost::filesystem::path)> confirm_overwrite
+ )
+{
+ /* No specific screen */
+ name_values['s'] = "";
+
+ int written = 0;
+
+ BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
+ boost::filesystem::path path = directory;
+ name_values['c'] = i.cinema->name;
+ 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();
+ }
+ }
+
+ return written;
+}
+
+/** Email one ZIP file per cinema to the cinema.
+ * @param cinema_kdms KDMS to email.
+ * @param container_name_format Format of folder / ZIP to use.
+ * @param filename_format Format of filenames to use.
+ * @param name_values Values to substitute into \p container_name_format and \p filename_format.
+ * @param cpl_name Name of the CPL that the KDMs are for.
+ * @param log Log to write email session transcript to, or 0.
+ */