Try to clean up KDM creation code a bit.
[dcpomatic.git] / src / lib / send_kdm_email_job.cc
index 541307f5acc8ace90d682b5b396046ddcdcbab2e..926ff6ee8cdfaf293b3808d3902bce947a99ae2b 100644 (file)
@@ -20,7 +20,7 @@
 #include "send_kdm_email_job.h"
 #include "compose.hpp"
 #include "film.h"
-#include "kdm.h"
+#include "cinema_kdms.h"
 
 #include "i18n.h"
 
@@ -29,16 +29,16 @@ using std::list;
 using boost::shared_ptr;
 
 SendKDMEmailJob::SendKDMEmailJob (
-       shared_ptr<const Film> f,
+       shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
-       boost::filesystem::path dcp,
+       boost::filesystem::path cpl,
        boost::posix_time::ptime from,
        boost::posix_time::ptime to,
        dcp::Formulation formulation
        )
-       : Job (f)
+       : Job (film)
        , _screens (screens)
-       , _dcp (dcp)
+       , _cpl (cpl)
        , _from (from)
        , _to (to)
        , _formulation (formulation)
@@ -52,16 +52,29 @@ SendKDMEmailJob::name () const
        return String::compose (_("Email KDMs for %1"), _film->name());
 }
 
+string
+SendKDMEmailJob::json_name () const
+{
+       return N_("send_kdm_email");
+}
+
 void
 SendKDMEmailJob::run ()
 {
        try {
-               
+
                set_progress_unknown ();
-               email_kdms (_film, _screens, _dcp, _from, _to, _formulation);
+
+               CinemaKDMs::email (
+                       _film,
+                       CinemaKDMs::collect (ScreenKDM::collect (_screens, _film->make_kdms (_screens, _cpl, _from, _to, _formulation))),
+                       _from,
+                       _to
+                       );
+
                set_progress (1);
                set_state (FINISHED_OK);
-               
+
        } catch (std::exception& e) {
 
                set_progress (1);