summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-01-27 01:52:22 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-16 01:20:17 +0100
commitf015d6b314a6bfc8534e3e2c331d6edd5f817e25 (patch)
tree04185cfa94b2a8c5c63be34d33432579f3a603ee /src/tools
parent4fb6584369785db4c03d9d0c536b57b25509f2ff (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.cc21
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) {