Configurable window arrangement in player dual-screen mode.
[dcpomatic.git] / src / lib / cinema_kdms.cc
index dc9bfd3d77f83023142229c4374c2bbd6f66a773..aaeb0d9056f3f89b94b9c62c731b4a8edd7912ef 100644 (file)
@@ -65,6 +65,7 @@ CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat nam
                }
 
                name_values['s'] = i.screen->name;
+               name_values['i'] = i.kdm.id ();
                string const name = name_format.get(name_values, ".xml");
                if (zip_add (zip, name.c_str(), source) == -1) {
                        throw runtime_error ("failed to add KDM to ZIP archive");
@@ -208,7 +209,8 @@ CinemaKDMs::email (
 
                name_values['c'] = i.cinema->name;
 
-               boost::filesystem::path zip_file = boost::filesystem::temp_directory_path();
+               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);
 
@@ -246,6 +248,7 @@ CinemaKDMs::email (
                try {
                        email.send (c->mail_server(), c->mail_port(), c->mail_user(), c->mail_password());
                } catch (...) {
+                       boost::filesystem::remove (zip_file);
                        if (log) {
                                log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
                                log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
@@ -255,6 +258,8 @@ CinemaKDMs::email (
                        throw;
                }
 
+               boost::filesystem::remove (zip_file);
+
                if (log) {
                        log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
                        log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);