Merge master.
[dcpomatic.git] / src / lib / kdm.cc
index 00d2f053781246e9631d7785ba3739e56de46a9c..c08750961e2c7c77245191e8e99f2b97daf5d875 100644 (file)
@@ -21,7 +21,7 @@
 #include <boost/shared_ptr.hpp>
 #include <quickmail.h>
 #include <zip.h>
-#include <dcp/kdm.h>
+#include <dcp/encrypted_kdm.h>
 #include "kdm.h"
 #include "cinema.h"
 #include "exceptions.h"
@@ -36,13 +36,13 @@ using boost::shared_ptr;
 
 struct ScreenKDM
 {
-       ScreenKDM (shared_ptr<Screen> s, dcp::KDM k)
+       ScreenKDM (shared_ptr<Screen> s, dcp::EncryptedKDM k)
                : screen (s)
                , kdm (k)
        {}
        
        shared_ptr<Screen> screen;
-       dcp::KDM kdm;
+       dcp::EncryptedKDM kdm;
 };
 
 static string
@@ -102,17 +102,17 @@ static list<ScreenKDM>
 make_screen_kdms (
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
-       boost::filesystem::path dcp,
-       boost::posix_time::ptime from,
-       boost::posix_time::ptime to
+       boost::filesystem::path cpl,
+       dcp::LocalTime from,
+       dcp::LocalTime to
        )
 {
-       list<dcp::KDM> kdms = film->make_kdms (screens, dcp, from, to);
+       list<dcp::EncryptedKDM> kdms = film->make_kdms (screens, cpl, from, to);
           
        list<ScreenKDM> screen_kdms;
        
        list<shared_ptr<Screen> >::iterator i = screens.begin ();
-       list<dcp::KDM>::iterator j = kdms.begin ();
+       list<dcp::EncryptedKDM>::iterator j = kdms.begin ();
        while (i != screens.end() && j != kdms.end ()) {
                screen_kdms.push_back (ScreenKDM (*i, *j));
                ++i;
@@ -126,12 +126,12 @@ static list<CinemaKDMs>
 make_cinema_kdms (
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
-       boost::filesystem::path dcp,
-       boost::posix_time::ptime from,
-       boost::posix_time::ptime to
+       boost::filesystem::path cpl,
+       dcp::LocalTime from,
+       dcp::LocalTime to
        )
 {
-       list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, dcp, from, to);
+       list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to);
        list<CinemaKDMs> cinema_kdms;
 
        while (!screen_kdms.empty ()) {
@@ -164,17 +164,20 @@ make_cinema_kdms (
        return cinema_kdms;
 }
 
+/** @param from KDM from time in local time.
+ *  @param to KDM to time in local time.
+ */
 void
 write_kdm_files (
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
-       boost::filesystem::path dcp,
-       boost::posix_time::ptime from,
-       boost::posix_time::ptime to,
+       boost::filesystem::path cpl,
+       dcp::LocalTime from,
+       dcp::LocalTime to,
        boost::filesystem::path directory
        )
 {
-       list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, dcp, from, to);
+       list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to);
 
        /* Write KDMs to the specified directory */
        for (list<ScreenKDM>::iterator i = screen_kdms.begin(); i != screen_kdms.end(); ++i) {
@@ -188,13 +191,13 @@ void
 write_kdm_zip_files (
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
-       boost::filesystem::path dcp,
-       boost::posix_time::ptime from,
-       boost::posix_time::ptime to,
+       boost::filesystem::path cpl,
+       dcp::LocalTime from,
+       dcp::LocalTime to,
        boost::filesystem::path directory
        )
 {
-       list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, dcp, from, to);
+       list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to);
 
        for (list<CinemaKDMs>::const_iterator i = cinema_kdms.begin(); i != cinema_kdms.end(); ++i) {
                boost::filesystem::path path = directory;
@@ -207,12 +210,12 @@ void
 email_kdms (
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
-       boost::filesystem::path dcp,
-       boost::posix_time::ptime from,
-       boost::posix_time::ptime to
+       boost::filesystem::path cpl,
+       dcp::LocalTime from,
+       dcp::LocalTime to
        )
 {
-       list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, dcp, from, to);
+       list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to);
 
        for (list<CinemaKDMs>::const_iterator i = cinema_kdms.begin(); i != cinema_kdms.end(); ++i) {