summaryrefslogtreecommitdiff
path: root/src/lib/film.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-02-21 01:19:03 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-21 01:19:03 +0100
commit791c8b584d8d408c30e1c5fa6ff9c00685650687 (patch)
tree5b9e1d928bce88dcf0f65df16affec41fc8ba7a2 /src/lib/film.cc
parent9f9c91448f4796981497cd9d12b285ccd08f4a6a (diff)
Add Film::last_written_by_git().
Diffstat (limited to 'src/lib/film.cc')
-rw-r--r--src/lib/film.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 0079f87c9..3af1a5e18 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -566,7 +566,9 @@ Film::read_metadata(optional<boost::filesystem::path> path)
}
}
- _last_written_by = f.optional_string_child("LastWrittenBy");
+ if (auto last = f.optional_node_child("LastWrittenBy")) {
+ _last_written_by = LastWrittenBy{last->content(), last->string_attribute("git")};
+ }
_name = f.string_child("Name");
if (_state_version >= 9) {
@@ -2470,6 +2472,18 @@ Film::set_dirty(bool dirty)
}
+bool
+Film::last_written_by_git() const
+{
+ if (_last_written_by) {
+ auto len = std::min(_last_written_by->version.length(), _last_written_by->git.length());
+ return _last_written_by->version.substr(0, len) == _last_written_by->git.substr(0, len);
+ }
+
+ return false;
+}
+
+
/** @return true if the metadata was (probably) last written by a version earlier
* than the given one; false if it definitely was not.
*/
@@ -2481,7 +2495,7 @@ Film::last_written_by_earlier_than(int major, int minor, int micro) const
}
vector<string> parts;
- boost::split(parts, *_last_written_by, boost::is_any_of("."));
+ boost::split(parts, _last_written_by->version, boost::is_any_of("."));
if (parts.size() != 3) {
/* Not sure what's going on, so let's say it was written by an old version */