Normalise XML attribute names to be camelCase (#2241).
[dcpomatic.git] / src / lib / film.cc
index d5597b5a12dfa49b13255fd49b42f7fd38a65977..6f19418b56579883c48b343efb52215cbc09b077 100644 (file)
@@ -425,7 +425,7 @@ Film::metadata (bool with_content_paths) const
        root->add_child("UserExplicitVideoFrameRate")->add_child_text(_user_explicit_video_frame_rate ? "1" : "0");
        for (map<dcp::Marker, DCPTime>::const_iterator i = _markers.begin(); i != _markers.end(); ++i) {
                auto m = root->add_child("Marker");
-               m->set_attribute("Type", dcp::marker_to_string(i->first));
+               m->set_attribute("type", dcp::marker_to_string(i->first));
                m->add_child_text(raw_convert<string>(i->second.get()));
        }
        for (auto i: _ratings) {
@@ -605,7 +605,11 @@ Film::read_metadata (optional<boost::filesystem::path> path)
        _user_explicit_video_frame_rate = f.optional_bool_child("UserExplicitVideoFrameRate").get_value_or(false);
 
        for (auto i: f.node_children("Marker")) {
-               _markers[dcp::marker_from_string(i->string_attribute("Type"))] = DCPTime(dcp::raw_convert<DCPTime::Type>(i->content()));
+               auto type = i->optional_string_attribute("Type");
+               if (!type) {
+                       type = i->string_attribute("type");
+               }
+               _markers[dcp::marker_from_string(*type)] = DCPTime(dcp::raw_convert<DCPTime::Type>(i->content()));
        }
 
        for (auto i: f.node_children("Rating")) {