Log content change checking. content-changed
authorCarl Hetherington <cth@carlh.net>
Fri, 12 May 2023 10:29:58 +0000 (12:29 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 May 2023 10:29:58 +0000 (12:29 +0200)
src/lib/content.cc

index 97edc7c892c33612263ae14b33e403d3a0b1bd11..f0397a8cf5d09c3034274bbf1bc2c75f0079c117 100644 (file)
@@ -29,6 +29,7 @@
 #include "compose.hpp"
 #include "content.h"
 #include "content_factory.h"
+#include "dcpomatic_log.h"
 #include "exceptions.h"
 #include "film.h"
 #include "job.h"
@@ -562,11 +563,19 @@ Content::changed () const
 {
        bool write_time_changed = false;
        for (auto i = 0U; i < _paths.size(); ++i) {
-               if (boost::filesystem::last_write_time(_paths[i]) != last_write_time(i)) {
+               auto const current_last_write_time = boost::filesystem::last_write_time(_paths[i]);
+               if (current_last_write_time != last_write_time(i)) {
+                       LOG_GENERAL("Content %1 write time changed from %2 to %3", _paths[i], last_write_time(i), current_last_write_time);
                        write_time_changed = true;
                        break;
                }
        }
 
-       return (write_time_changed || calculate_digest() != digest());
+       /* Only check digest if the write time is the same */
+       auto const digest_changed = !write_time_changed && (calculate_digest() != digest());
+       if (digest_changed) {
+               LOG_GENERAL("Content %1 digest changed", _paths[0]);
+       }
+
+       return (write_time_changed || digest_changed);
 }