diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 17 | ||||
| -rw-r--r-- | src/lib/film.h | 6 | ||||
| -rw-r--r-- | src/lib/util.cc | 51 |
3 files changed, 10 insertions, 64 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index d218524f4..8252b492c 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -895,12 +895,11 @@ Film::full_frame () const return libdcp::Size (); } -void +list<libdcp::KDM> Film::make_kdms ( list<shared_ptr<Screen> > screens, boost::posix_time::ptime from, - boost::posix_time::ptime until, - string directory + boost::posix_time::ptime until ) const { boost::filesystem::path const sd = Config::instance()->signer_chain_directory (); @@ -948,6 +947,8 @@ Film::make_kdms ( throw KDMError (_("More than one possible DCP to make KDM for")); } + list<libdcp::KDM> kdms; + for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) { libdcp::DCP dcp (dcps.front ()); @@ -963,14 +964,10 @@ Film::make_kdms ( string const issue_date = libdcp::tm_to_string (tm); dcp.cpls().front()->set_mxf_keys (key ()); - - libdcp::KDM kdm ( - dcp.cpls().front(), signer, (*i)->certificate, from, until, "DCP-o-matic", issue_date - ); - boost::filesystem::path out = directory; - out /= tidy_for_filename ((*i)->cinema->name) + "_" + tidy_for_filename ((*i)->name) + ".kdm.xml"; - kdm.as_xml (out); + kdms.push_back (libdcp::KDM (dcp.cpls().front(), signer, (*i)->certificate, from, until, "DCP-o-matic", issue_date)); } + + return kdms; } diff --git a/src/lib/film.h b/src/lib/film.h index 26623e69e..a30a630b9 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -32,6 +32,7 @@ #include <boost/enable_shared_from_this.hpp> #include <boost/filesystem.hpp> #include <libdcp/key.h> +#include <libdcp/kdm.h> #include "util.h" #include "types.h" #include "dci_metadata.h" @@ -115,11 +116,10 @@ public: bool has_subtitles () const; OutputVideoFrame best_video_frame_rate () const; - void make_kdms ( + std::list<libdcp::KDM> make_kdms ( std::list<boost::shared_ptr<Screen> >, boost::posix_time::ptime from, - boost::posix_time::ptime until, - std::string directory + boost::posix_time::ptime until ) const; libdcp::Key key () const { diff --git a/src/lib/util.cc b/src/lib/util.cc index 739a327d6..6746b4773 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -54,7 +54,6 @@ extern "C" { #include <libpostproc/postprocess.h> #include <libavutil/pixfmt.h> } -#include <curl/curl.h> #include "util.h" #include "exceptions.h" #include "scaler.h" @@ -817,53 +816,3 @@ tidy_for_filename (string f) return t; } - -struct EmailState -{ - string message; - int done; -}; - -static size_t -send_email_function (void* ptr, size_t size, size_t nmemb, void* userdata) -{ - EmailState* state = reinterpret_cast<EmailState*> (userdata); - - int const now = min (size * nmemb, state->message.length() - state->done); - - memcpy (ptr, state->message.c_str() + state->done, now); - state->done += now; - - return now; -} - -bool -send_email (string from, string to, string message) -{ - CURL* curl = curl_easy_init (); - if (!curl) { - return true; - } - - string const url = "smtp://" + Config::instance()->mail_server(); - - curl_easy_setopt (curl, CURLOPT_URL, url.c_str ()); - curl_easy_setopt (curl, CURLOPT_MAIL_FROM, from.c_str ()); - struct curl_slist* recipients = 0; - recipients = curl_slist_append (recipients, to.c_str ()); - curl_easy_setopt (curl, CURLOPT_READFUNCTION, send_email_function); - - EmailState state; - state.message = message; - state.done = 0; - curl_easy_setopt (curl, CURLOPT_READDATA, &state); - - if (curl_easy_perform (curl) != CURLE_OK) { - return true; - } - - curl_slist_free_all (recipients); - curl_easy_cleanup (curl); - - return false; -} |
