Add DiskWriterBackendResponse::write_to_nanomsg() and use it
[dcpomatic.git] / src / tools / dcpomatic_cli.cc
index 71353d463858e9ee5da47cd01e5d39aa8445fd0c..5e55b4da273d93e93ff1ad749a228d046d896269 100644 (file)
@@ -196,6 +196,62 @@ list_servers ()
 }
 
 
+bool
+show_jobs_on_console (bool progress)
+{
+       bool first = true;
+       bool error = false;
+       while (true) {
+
+               dcpomatic_sleep_seconds (5);
+
+               auto jobs = JobManager::instance()->get();
+
+               if (!first && progress) {
+                       for (size_t i = 0; i < jobs.size(); ++i) {
+                               cout << "\033[1A\033[2K";
+                       }
+                       cout.flush ();
+               }
+
+               first = false;
+
+               for (auto i: jobs) {
+                       if (progress) {
+                               cout << i->name();
+                               if (!i->sub_name().empty()) {
+                                       cout << "; " << i->sub_name();
+                               }
+                               cout << ": ";
+
+                               if (i->progress ()) {
+                                       cout << i->status() << "                            \n";
+                               } else {
+                                       cout << ": Running           \n";
+                               }
+                       }
+
+                       if (!progress && i->finished_in_error()) {
+                               /* We won't see this error if we haven't been showing progress,
+                                  so show it now.
+                               */
+                               cout << i->status() << "\n";
+                       }
+
+                       if (i->finished_in_error()) {
+                               error = true;
+                       }
+               }
+
+               if (!JobManager::instance()->work_to_do()) {
+                       break;
+               }
+       }
+
+       return error;
+}
+
+
 int
 main (int argc, char* argv[])
 {
@@ -301,19 +357,18 @@ main (int argc, char* argv[])
        }
 
        if (servers) {
-               auto f = fopen_boost (*servers, "r");
+               dcp::File f(*servers, "r");
                if (!f) {
                        cerr << "Could not open servers list file " << *servers << "\n";
                        exit (EXIT_FAILURE);
                }
                vector<string> servers;
-               while (!feof (f)) {
+               while (!f.eof()) {
                        char buffer[128];
-                       if (fscanf (f, "%s.127", buffer) == 1) {
+                       if (fscanf(f.get(), "%s.127", buffer) == 1) {
                                servers.push_back (buffer);
                        }
                }
-               fclose (f);
                Config::instance()->set_servers (servers);
        }
 
@@ -400,7 +455,7 @@ main (int argc, char* argv[])
                auto job = std::make_shared<TranscodeJob>(film, behaviour);
                job->set_encoder (
                        std::make_shared<FFmpegEncoder> (
-                               film, job, *export_filename, *export_format == "mp4" ? ExportFormat::H264_AAC : ExportFormat::PRORES, false, false, false, 23
+                               film, job, *export_filename, *export_format == "mp4" ? ExportFormat::H264_AAC : ExportFormat::PRORES_HQ, false, false, false, 23
                                )
                        );
                JobManager::instance()->add (job);
@@ -413,7 +468,6 @@ main (int argc, char* argv[])
                }
        }
 
-       make_dcp (film, behaviour);
        bool const error = show_jobs_on_console (progress);
 
        if (keep_going) {