2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <libdcp/test_mode.h>
24 #include <libdcp/version.h>
28 #include "transcode_job.h"
29 #include "make_dcp_job.h"
30 #include "job_manager.h"
31 #include "ab_transcode_job.h"
38 using namespace boost;
43 cerr << "Syntax: " << n << " [OPTION] <FILM>\n"
44 << " -v, --version show DVD-o-matic version\n"
45 << " -h, --help show this help\n"
46 << " -d, --deps list DVD-o-matic dependency details and quit\n"
47 << " -t, --test run in test mode (repeatable UUID generation, timestamps etc.)\n"
48 << " -n, --no-progress do not print progress to stdout\n"
50 << "<FILM> is the film directory.\n";
54 main (int argc, char* argv[])
57 bool test_mode = false;
62 static struct option long_options[] = {
63 { "version", no_argument, 0, 'v'},
64 { "help", no_argument, 0, 'h'},
65 { "deps", no_argument, 0, 'd'},
66 { "test", no_argument, 0, 't'},
67 { "no-progress", no_argument, 0, 'n'},
71 int c = getopt_long (argc, argv, "hdtn", long_options, &option_index);
79 cout << "dvdomatic version " << DVDOMATIC_VERSION << "\n";
85 cout << dependency_version_summary () << "\n";
101 film_dir = argv[optind];
105 cout << "DVD-o-matic " << dvdomatic_version << " git " << dvdomatic_git_commit;
107 if (gethostname (buf, 256) == 0) {
108 cout << " on " << buf;
113 libdcp::enable_test_mode ();
114 cout << dependency_version_summary() << "\n";
119 film = new Film (film_dir, true);
120 } catch (std::exception& e) {
121 cerr << argv[0] << ": error reading film `" << film_dir << "' (" << e.what() << ")\n";
126 if (film->dcp_ab ()) {
129 cout << "DCP for " << film->name() << "\n";
130 cout << "Test mode: " << (test_mode ? "yes" : "no") << "\n";
131 cout << "Content: " << film->content() << "\n";
132 pair<string, string> const f = Filter::ffmpeg_strings (film->filters ());
133 cout << "Filters: " << f.first << " " << f.second << "\n";
135 film->make_dcp (true);
137 list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
139 bool all_done = false;
145 if (!first && progress) {
146 cout << "\033[" << jobs.size() << "A";
153 for (list<shared_ptr<Job> >::iterator i = jobs.begin(); i != jobs.end(); ++i) {
155 cout << (*i)->name() << ": ";
157 float const p = (*i)->overall_progress ();
160 cout << (*i)->status() << " \n";
162 cout << ": Running \n";
166 if (!(*i)->finished ()) {
170 if (!progress && (*i)->finished_in_error ()) {
171 /* We won't see this error if we haven't been showing progress,
174 cout << (*i)->status() << "\n";