diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-01-27 01:52:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-01-28 21:09:46 +0100 |
| commit | 81e46225d94ab69482b9fdb345ac173e7b9cb077 (patch) | |
| tree | f73db93242d55663fe72ff1468f7c733c702cf38 /src/tools | |
| parent | d78c219844b3a7e04c17771030f0b67e529246aa (diff) | |
Move _film out of Job into only those Jobs that need it.
This meant some tweaks to the JSON server to only report DCP names for
TranscodeJobs, and a bit of (hopefully) tidying of the disk space check
in the batch converter.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_batch.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index ee35034f4..4feb2d954 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -61,9 +61,11 @@ using std::dynamic_pointer_cast; using std::exception; using std::list; using std::make_shared; +using std::pair; using std::set; using std::shared_ptr; using std::string; +using std::vector; using boost::scoped_array; using boost::thread; #if BOOST_VERSION >= 106100 @@ -222,23 +224,18 @@ public: film->should_be_enough_disk_space(total_required, available); - set<shared_ptr<const Film>> films; + vector<pair<shared_ptr<const Film>, float>> films_with_progress; for (auto i: JobManager::instance()->get()) { - films.insert (i->film()); - } - - for (auto i: films) { - double progress = 0; - for (auto j: JobManager::instance()->get()) { - if (i == j->film() && dynamic_pointer_cast<TranscodeJob>(j)) { - progress = j->progress().get_value_or(0); - } + if (auto transcode = dynamic_pointer_cast<TranscodeJob>(i)) { + films_with_progress.push_back({ transcode->film(), i->progress().get_value_or(0) }); } + } + for (auto const& i: films_with_progress) { double required; - i->should_be_enough_disk_space(required, available); - total_required += (1 - progress) * required; + i.first->should_be_enough_disk_space(required, available); + total_required += (1 - i.second) * required; } if ((total_required - available) > 1) { |
