Change end() to only do one thing, and copy the required stuff into pause()
[dcpomatic.git] / src / lib / dkdm_wrapper.cc
index f5eb435f6d0fc06989478a70a21f306b2bb1dd11..7beaae8f478d4099fc6590db149a23e7ebd69bb9 100644 (file)
@@ -41,7 +41,11 @@ DKDMBase::read (cxml::ConstNodePtr node)
        if (node->name() == "DKDM") {
                return make_shared<DKDM>(dcp::EncryptedKDM(node->content()));
        } else if (node->name() == "DKDMGroup") {
-               auto group = make_shared<DKDMGroup>(node->string_attribute("Name"));
+               auto name = node->optional_string_attribute("Name");
+               if (!name) {
+                       name = node->string_attribute("name");
+               }
+               auto group = make_shared<DKDMGroup>(*name);
                for (auto i: node->node_children()) {
                        if (auto c = read(i)) {
                                group->add (c);
@@ -72,7 +76,7 @@ void
 DKDMGroup::as_xml (xmlpp::Element* node) const
 {
        auto f = node->add_child("DKDMGroup");
-       f->set_attribute ("Name", _name);
+       f->set_attribute("name", _name);
        for (auto i: _children) {
                i->as_xml (f);
        }
@@ -131,3 +135,15 @@ DKDMGroup::contains(string dkdm_id) const
        return false;
 }
 
+
+bool
+DKDMGroup::contains_dkdm() const
+{
+       for (auto child: _children) {
+               if (child->contains_dkdm()) {
+                       return true;
+               }
+       }
+
+       return false;
+}