return file (p);
}
-/** Find all the DCPs in our directory that can be dcp::DCP::read() and return details of their CPLs */
+static
+bool
+cpl_summary_compare (CPLSummary const & a, CPLSummary const & b)
+{
+ return a.last_write_time > b.last_write_time;
+}
+
+/** Find all the DCPs in our directory that can be dcp::DCP::read() and return details of their CPLs.
+ * The list will be returned in reverse order of timestamp (i.e. most recent first).
+ */
vector<CPLSummary>
Film::cpls () const
{
}
}
+ sort (out.begin(), out.end(), cpl_summary_compare);
+
return out;
}
void as_xml (xmlpp::Node *) const;
};
+extern bool operator== (Crop const & a, Crop const & b);
+extern bool operator!= (Crop const & a, Crop const & b);
+
struct CPLSummary
{
CPLSummary (boost::filesystem::path p);
- CPLSummary (std::string d, std::string i, std::string a, boost::filesystem::path f, bool e)
+ CPLSummary (std::string d, std::string i, std::string a, boost::filesystem::path f, bool e, time_t t)
: dcp_directory (d)
, cpl_id (i)
, cpl_annotation_text (a)
, cpl_file (f)
, encrypted (e)
+ , last_write_time (t)
{}
std::string dcp_directory;
boost::filesystem::path cpl_file;
/** true if this CPL has any encrypted assets */
bool encrypted;
+ time_t last_write_time;
};
-extern bool operator== (Crop const & a, Crop const & b);
-extern bool operator!= (Crop const & a, Crop const & b);
-
enum Resolution {
RESOLUTION_2K,
RESOLUTION_4K
return;
}
+ /* We're ignoring the CPLSummary timestamp stuff here and just putting the new one in at the end
+ of the list, then selecting it.
+ */
+
try {
_cpls.push_back (
CPLSummary (
cpl_document.string_child("Id").substr (9),
cpl_document.string_child("ContentTitleText"),
cpl_file,
- encrypted
+ encrypted,
+ 0
)
);
} catch (cxml::Error) {