summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-02 12:06:20 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-02 12:06:20 +0100
commit3574212ee42b2bd924eb95d5c0f4f69ec9e0a2f0 (patch)
tree24e46f4f566bfb98aa48e9dab602ec1c8d0591d6 /src/tools
parent24d54ea7fe1ba128cf8d3521d6738fc73a7c623e (diff)
parent8fb0f4eaa6d91ca9369f45dd7a57c29149edaaac (diff)
Merge master.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc29
-rw-r--r--src/tools/dcpomatic_cli.cc9
-rw-r--r--src/tools/dcpomatic_kdm.cc20
3 files changed, 23 insertions, 35 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index f2aff9359..23c1e5005 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -30,6 +30,7 @@
#include <wx/stdpaths.h>
#include <wx/cmdline.h>
#include <wx/preferences.h>
+#include <libdcp/exceptions.h>
#include "wx/film_viewer.h"
#include "wx/film_editor.h"
#include "wx/job_manager_view.h"
@@ -74,7 +75,6 @@ using boost::dynamic_pointer_cast;
static FilmEditor* film_editor = 0;
static FilmViewer* film_viewer = 0;
static shared_ptr<Film> film;
-static std::string log_level;
static std::string film_to_load;
static std::string film_to_create;
static std::string content_to_add;
@@ -157,13 +157,12 @@ load_film (boost::filesystem::path file)
for (list<string>::const_iterator i = notes.begin(); i != notes.end(); ++i) {
error_dialog (0, std_to_wx (*i));
}
- film->log()->set_level (log_level);
}
#define ALWAYS 0x0
#define NEEDS_FILM 0x1
#define NOT_DURING_DCP_CREATION 0x2
-#define NEEDS_DCP 0x4
+#define NEEDS_CPL 0x4
map<wxMenuItem*, int> menu_items;
@@ -183,7 +182,7 @@ set_menu_sensitivity ()
++i;
}
bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished ();
- bool const have_dcp = film && !film->dcps().empty ();
+ bool const have_cpl = film && !film->cpls().empty ();
for (map<wxMenuItem*, int>::iterator j = menu_items.begin(); j != menu_items.end(); ++j) {
@@ -197,7 +196,7 @@ set_menu_sensitivity ()
enabled = false;
}
- if ((j->second & NEEDS_DCP) && !have_dcp) {
+ if ((j->second & NEEDS_CPL) && !have_cpl) {
enabled = false;
}
@@ -249,9 +248,9 @@ setup_menu (wxMenuBar* m)
jobs_menu = new wxMenu;
add_item (jobs_menu, _("&Make DCP"), ID_jobs_make_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION);
- add_item (jobs_menu, _("Make &KDMs..."), ID_jobs_make_kdms, NEEDS_FILM | NEEDS_DCP);
- add_item (jobs_menu, _("&Send DCP to TMS"), ID_jobs_send_dcp_to_tms, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_DCP);
- add_item (jobs_menu, _("S&how DCP"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_DCP);
+ add_item (jobs_menu, _("Make &KDMs..."), ID_jobs_make_kdms, NEEDS_FILM);
+ add_item (jobs_menu, _("&Send DCP to TMS"), ID_jobs_send_dcp_to_tms, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL);
+ add_item (jobs_menu, _("S&how DCP"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_CPL);
wxMenu* tools = new wxMenu;
add_item (tools, _("Hints..."), ID_tools_hints, 0);
@@ -401,7 +400,6 @@ private:
maybe_save_then_delete_film ();
film.reset (new Film (d->get_path ()));
film->write_metadata ();
- film->log()->set_level (log_level);
film->set_name (boost::filesystem::path (d->get_path()).filename().generic_string());
set_film ();
}
@@ -497,12 +495,14 @@ private:
try {
if (d->write_to ()) {
- write_kdm_files (film, d->screens (), d->dcp (), d->from (), d->until (), d->directory ());
+ write_kdm_files (film, d->screens (), d->cpl (), d->from (), d->until (), d->directory ());
} else {
JobManager::instance()->add (
- shared_ptr<Job> (new SendKDMEmailJob (film, d->screens (), d->dcp (), d->from (), d->until ()))
+ shared_ptr<Job> (new SendKDMEmailJob (film, d->screens (), d->cpl (), d->from (), d->until ()))
);
}
+ } catch (libdcp::NotEncryptedError& e) {
+ error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
error_dialog (this, e.what ());
} catch (...) {
@@ -609,7 +609,6 @@ private:
};
static const wxCmdLineEntryDesc command_line_description[] = {
- { wxCMD_LINE_OPTION, "l", "log", "set log level (silent, verbose or timing)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_OPTION, "c", "content", "add content file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
@@ -671,7 +670,6 @@ class App : public wxApp
if (!film_to_create.empty ()) {
film.reset (new Film (film_to_create));
film->write_metadata ();
- film->log()->set_level (log_level);
film->set_name (boost::filesystem::path (film_to_create).filename().generic_string ());
}
@@ -729,11 +727,6 @@ class App : public wxApp
content_to_add = wx_to_std (content);
}
- wxString log;
- if (parser.Found (wxT ("log"), &log)) {
- log_level = wx_to_std (log);
- }
-
return true;
}
diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc
index d95b2ed99..acd1335e6 100644
--- a/src/tools/dcpomatic_cli.cc
+++ b/src/tools/dcpomatic_cli.cc
@@ -65,7 +65,6 @@ main (int argc, char* argv[])
string film_dir;
bool progress = true;
bool no_remote = false;
- int log_level = 0;
int json_port = 0;
bool keep_going = false;
@@ -78,13 +77,12 @@ main (int argc, char* argv[])
{ "flags", no_argument, 0, 'f'},
{ "no-progress", no_argument, 0, 'n'},
{ "no-remote", no_argument, 0, 'r'},
- { "log-level", required_argument, 0, 'l' },
{ "json", required_argument, 0, 'j' },
{ "keep-going", no_argument, 0, 'k' },
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "vhdfnrl:j:k", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhdfnrj:k", long_options, &option_index);
if (c == -1) {
break;
@@ -109,9 +107,6 @@ main (int argc, char* argv[])
case 'r':
no_remote = true;
break;
- case 'l':
- log_level = atoi (optarg);
- break;
case 'j':
json_port = atoi (optarg);
break;
@@ -155,8 +150,6 @@ main (int argc, char* argv[])
exit (EXIT_FAILURE);
}
- film->log()->set_level ((Log::Level) log_level);
-
cout << "\nMaking DCP for " << film->name() << "\n";
// cout << "Content: " << film->content() << "\n";
// pair<string, string> const f = Filter::ffmpeg_strings (film->filters ());
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 2f6916df2..0f2d5b8a3 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -30,6 +30,7 @@ using std::stringstream;
using std::cout;
using std::cerr;
using std::list;
+using std::vector;
using boost::shared_ptr;
static string program_name;
@@ -219,14 +220,14 @@ int main (int argc, char* argv[])
}
/* XXX: allow specification of this */
- list<boost::filesystem::path> dcps = film->dcps ();
- if (dcps.empty ()) {
- error ("no DCPs found in film");
- } else if (dcps.size() > 1) {
- error ("more than one DCP found in film");
+ vector<CPLSummary> cpls = film->cpls ();
+ if (cpls.empty ()) {
+ error ("no CPLs found in film");
+ } else if (cpls.size() > 1) {
+ error ("more than one CPL found in film");
}
- boost::filesystem::path dcp = dcps.front ();
+ boost::filesystem::path cpl = cpls.front().cpl_file;
if (cinema_name.empty ()) {
@@ -235,7 +236,7 @@ int main (int argc, char* argv[])
}
shared_ptr<dcp::Certificate> certificate (new dcp::Certificate (boost::filesystem::path (certificate_file)));
- dcp::EncryptedKDM kdm = film->make_kdm (certificate, dcp, valid_from.get(), valid_to.get());
+ dcp::EncryptedKDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get());
kdm.as_xml (output);
if (verbose) {
cout << "Generated KDM " << output << " for certificate.\n";
@@ -259,12 +260,13 @@ int main (int argc, char* argv[])
try {
if (zip) {
- write_kdm_zip_files (film, (*i)->screens(), dcp, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), output);
+ write_kdm_zip_files (film, (*i)->screens(), cpl, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), output);
+
if (verbose) {
cout << "Wrote ZIP files to " << output << "\n";
}
} else {
- write_kdm_files (film, (*i)->screens(), dcp, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), output);
+ write_kdm_files (film, (*i)->screens(), cpl, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), output);
if (verbose) {
cout << "Wrote KDM files to " << output << "\n";
}