Rename some variables and re-implement collect().
[dcpomatic.git] / src / tools / dcpomatic_kdm.cc
index 1ff69d13562cd3dfcdd2f194be6c70796283506a..dd45401cb70c050c79c602c1d7a1e0a182daa680 100644 (file)
@@ -40,7 +40,6 @@
 #include "lib/job_manager.h"
 #include "lib/kdm_with_metadata.h"
 #include "lib/exceptions.h"
-#include "lib/cinema_kdms.h"
 #include "lib/send_kdm_email_job.h"
 #include "lib/compose.hpp"
 #include "lib/cinema.h"
@@ -303,7 +302,7 @@ private:
                                return;
                        }
 
-                       list<shared_ptr<KDMWithMetadata> > screen_kdms;
+                       list<KDMWithMetadataPtr> kdms;
                        string title;
 
 #ifdef DCPOMATIC_VARIANT_SWAROOP
@@ -326,10 +325,14 @@ private:
                                                dcp::LocalTime (_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute())
                                                );
 
+                                       dcp::NameFormat::Map name_values;
+                                       name_values['c'] = i->cinema->name;
+                                       name_values['s'] = i->name;
+
                                        /* Encrypt */
-                                       screen_kdms.push_back (
-                                               shared_ptr<KDMWithMetadata>(
-                                                       new ECinemaKDMWithMetadata(i, kdm.encrypt(i->recipient.get()))
+                                       kdms.push_back (
+                                               KDMWithMetadataPtr(
+                                                       new ECinemaKDMWithMetadata(name_values, i->cinema, kdm.encrypt(i->recipient.get()))
                                                        )
                                                );
                                }
@@ -369,11 +372,16 @@ private:
                                                kdm.add_key (j);
                                        }
 
+                                       dcp::NameFormat::Map name_values;
+                                       name_values['c'] = i->cinema->name;
+                                       name_values['s'] = i->name;
+
                                        /* Encrypt */
-                                       screen_kdms.push_back (
-                                               shared_ptr<KDMWithMetadata>(
+                                       kdms.push_back (
+                                               KDMWithMetadataPtr(
                                                        new DCPKDMWithMetadata(
-                                                               i,
+                                                               name_values,
+                                                               i->cinema,
                                                                kdm.encrypt(
                                                                        signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(),
                                                                        !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0
@@ -384,12 +392,12 @@ private:
                                }
                        }
 
-                       if (screen_kdms.empty()) {
+                       if (kdms.empty()) {
                                return;
                        }
 
                        pair<shared_ptr<Job>, int> result = _output->make (
-                               screen_kdms, title, _timing, bind (&DOMFrame::confirm_overwrite, this, _1)
+                               kdms, title, _timing, bind (&DOMFrame::confirm_overwrite, this, _1)
                                );
 
                        if (result.first) {