Don't dump empty error details.
[dcpomatic.git] / src / tools / dcpomatic_create.cc
index 4c40c24d3ce2384970e5b12ce39353a84888b655..345c0182bc8215765c9b57de17469f114a51f9e8 100644 (file)
@@ -45,6 +45,7 @@
 #include <stdexcept>
 #include <string>
 
+
 using std::cerr;
 using std::cout;
 using std::dynamic_pointer_cast;
@@ -53,8 +54,10 @@ using std::list;
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
+using std::vector;
 using boost::optional;
 
+
 class SimpleSignalManager : public SignalManager
 {
 public:
@@ -117,12 +120,14 @@ main (int argc, char* argv[])
 
                for (auto cli_content: cc.content) {
                        auto const can = boost::filesystem::canonical (cli_content.path);
-                       list<shared_ptr<Content>> film_content_list;
+                       vector<shared_ptr<Content>> film_content_list;
 
                        if (boost::filesystem::exists (can / "ASSETMAP") || (boost::filesystem::exists (can / "ASSETMAP.xml"))) {
                                auto dcp = make_shared<DCPContent>(can);
                                film_content_list.push_back (dcp);
-                               dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(*cli_content.kdm)));
+                               if (cli_content.kdm) {
+                                       dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(*cli_content.kdm)));
+                               }
                        } else {
                                /* I guess it's not a DCP */
                                film_content_list = content_factory (can);
@@ -171,8 +176,10 @@ main (int argc, char* argv[])
                if (jm->errors ()) {
                        for (auto i: jm->get()) {
                                if (i->finished_in_error()) {
-                                       cerr << i->error_summary() << "\n"
-                                            << i->error_details() << "\n";
+                                       cerr << i->error_summary() << "\n";
+                                       if (!i->error_details().empty()) {
+                                            cout << i->error_details() << "\n";
+                                       }
                                }
                        }
                        exit (EXIT_FAILURE);