Undo previous guess.
[dcpomatic.git] / src / lib / content.cc
index d2a07f79523f0e052b649a0d64425af9941b62d7..a41261998671d3083f54c3fd5c921ddeba7de89e 100644 (file)
 #include "ui_signaller.h"
 
 using std::string;
+using std::stringstream;
 using std::set;
 using boost::shared_ptr;
 using boost::lexical_cast;
 
-int const ContentProperty::POSITION = 400;
-int const ContentProperty::LENGTH = 401;
-int const ContentProperty::TRIM_START = 402;
-int const ContentProperty::TRIM_END = 403;
+int const ContentProperty::PATH = 400;
+int const ContentProperty::POSITION = 401;
+int const ContentProperty::LENGTH = 402;
+int const ContentProperty::TRIM_START = 403;
+int const ContentProperty::TRIM_END = 404;
 
 Content::Content (shared_ptr<const Film> f, Time p)
        : _film (f)
@@ -151,7 +153,7 @@ Content::clone () const
        xmlpp::Document doc;
        xmlpp::Node* node = doc.create_root_node ("Content");
        as_xml (node);
-       return content_factory (film, shared_ptr<cxml::Node> (new cxml::Node (node)));
+       return content_factory (film, cxml::NodePtr(new cxml::Node (node)));
 }
 
 string
@@ -174,3 +176,34 @@ Content::trimmed (Time t) const
 {
        return (t < trim_start() || t > (full_length() - trim_end ()));
 }
+
+/** @return string which includes everything about how this content affects
+ *  its playlist.
+ */
+string
+Content::identifier () const
+{
+       stringstream s;
+       
+       s << Content::digest()
+         << "_" << position()
+         << "_" << trim_start()
+         << "_" << trim_end();
+
+       return s.str ();
+}
+
+bool
+Content::path_valid () const
+{
+       return boost::filesystem::exists (_path);
+}
+
+void
+Content::set_path (boost::filesystem::path path)
+{
+       _path = path;
+       signal_changed (ContentProperty::PATH);
+}
+
+