diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-10 01:08:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-12-10 01:16:06 +0100 |
| commit | 02b74112721d13a27b0bbaece714d5c8ea743d43 (patch) | |
| tree | 3a27196ba8c53b603e0d3369593858e471a071f8 /src/tools | |
| parent | 11afb1f4bb9c8dd2e366ed216dd324d197d18b9a (diff) | |
Move some methods out of util.{cc,h}
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_cli.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index be5345f9e..5e55b4da2 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -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[]) { |
