summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-21 12:24:59 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-21 12:24:59 +0100
commit5b17eb3a0b0f95417c210ac3f7c3b66b5eac483c (patch)
tree0beda7d8d246b36c359a60cf9d6a233e5d6d58b1 /src
parent5911030f411e104778ad2c3faca8c8cb7bdbc387 (diff)
Missing frames treated as bad on check hashes. Try to stop running makedcp if jobs fail.
Diffstat (limited to 'src')
-rw-r--r--src/lib/check_hashes_job.cc23
-rw-r--r--src/tools/makedcp.cc24
2 files changed, 34 insertions, 13 deletions
diff --git a/src/lib/check_hashes_job.cc b/src/lib/check_hashes_job.cc
index d64ccc866..eff9153d9 100644
--- a/src/lib/check_hashes_job.cc
+++ b/src/lib/check_hashes_job.cc
@@ -55,15 +55,24 @@ CheckHashesJob::run ()
string const j2k_file = _opt->frame_out_path (i, false);
string const hash_file = j2k_file + ".md5";
- ifstream ref (hash_file.c_str ());
- string hash;
- ref >> hash;
-
- if (hash != md5_digest (j2k_file)) {
- _log->log ("Frame " + lexical_cast<string> (i) + " has wrong hash; deleting.");
- filesystem::remove (j2k_file);
+ if (!filesystem::exists (j2k_file)) {
+ _log->log (String::compose ("Frame %1 has a missing J2K file.", i));
filesystem::remove (hash_file);
++_bad;
+ } else if (!filesystem::exists (hash_file)) {
+ _log->log (String::compose ("Frame %1 has a missing hash file.", i));
+ filesystem::remove (j2k_file);
+ ++_bad;
+ } else {
+ ifstream ref (hash_file.c_str ());
+ string hash;
+ ref >> hash;
+ if (hash != md5_digest (j2k_file)) {
+ _log->log (String::compose ("Frame %1 has wrong hash; deleting.", i));
+ filesystem::remove (j2k_file);
+ filesystem::remove (hash_file);
+ ++_bad;
+ }
}
set_progress (float (i) / _fs->length());
diff --git a/src/tools/makedcp.cc b/src/tools/makedcp.cc
index 71a07fe71..23b68148d 100644
--- a/src/tools/makedcp.cc
+++ b/src/tools/makedcp.cc
@@ -164,9 +164,9 @@ main (int argc, char* argv[])
film->make_dcp (true);
- bool all_done = false;
+ bool should_stop = false;
bool first = true;
- while (!all_done) {
+ while (!should_stop) {
dvdomatic_sleep (5);
@@ -178,8 +178,10 @@ main (int argc, char* argv[])
}
first = false;
-
- all_done = true;
+
+ int unfinished = 0;
+ int finished_in_error = 0;
+
for (list<shared_ptr<Job> >::iterator i = jobs.begin(); i != jobs.end(); ++i) {
if (progress) {
cout << (*i)->name() << ": ";
@@ -192,9 +194,15 @@ main (int argc, char* argv[])
cout << ": Running \n";
}
}
-
+
if (!(*i)->finished ()) {
- all_done = false;
+ cout << (*i)->name() << " not finished.\n";
+ ++unfinished;
+ }
+
+ if ((*i)->finished_in_error ()) {
+ cout << (*i)->name() << " finished in error.\n";
+ ++finished_in_error;
}
if (!progress && (*i)->finished_in_error ()) {
@@ -204,6 +212,10 @@ main (int argc, char* argv[])
cout << (*i)->status() << "\n";
}
}
+
+ if (unfinished == 0 || finished_in_error != 0) {
+ should_stop = true;
+ }
}
return 0;