summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-06-17 22:35:39 +0200
committerCarl Hetherington <cth@carlh.net>2025-07-03 22:46:34 +0200
commitd4019480147bd6b478f8b067982c53251e5d6f15 (patch)
tree9cf10f9655b7ef332d3362da32eba4000cd1fe4d /src/wx
parentb4c7d661a2c7b072d18e82129ff0a31a99ba5081 (diff)
Add all DCP CPLs to the content list, and write CPL ID to SPLs instead of digest (#3040).
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/content_view.cc49
-rw-r--r--src/wx/content_view.h3
2 files changed, 43 insertions, 9 deletions
diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc
index 6a5a3793d..fa6bd64dc 100644
--- a/src/wx/content_view.cc
+++ b/src/wx/content_view.cc
@@ -30,8 +30,10 @@
#include "lib/examine_content_job.h"
#include "lib/job_manager.h"
#include "lib/util.h"
+#include <dcp/cpl.h>
#include <dcp/exceptions.h>
#include <dcp/filesystem.h>
+#include <dcp/search.h>
#include <dcp/warnings.h>
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
@@ -134,8 +136,17 @@ ContentView::update ()
if (i->finished_in_error()) {
error_dialog(this, std_to_wx(i->error_summary()) + char_to_wx(".\n"), std_to_wx(i->error_details()));
} else {
- add (i->content());
- _content.push_back (i->content());
+ if (auto dcp = dynamic_pointer_cast<DCPContent>(i->content())) {
+ for (auto cpl: dcp::find_and_resolve_cpls(dcp->directories(), true)) {
+ auto copy = dynamic_pointer_cast<DCPContent>(dcp->clone());
+ copy->set_cpl(cpl->id());
+ add(copy);
+ _content.push_back(copy);
+ }
+ } else {
+ add(i->content());
+ _content.push_back(i->content());
+ }
}
}
}
@@ -170,13 +181,35 @@ ContentView::add (shared_ptr<Content> content)
shared_ptr<Content>
-ContentView::get (string digest) const
+ContentView::get_by_digest(string digest) const
{
- for (auto i: _content) {
- if (i->digest() == digest) {
- return i;
- }
+ auto iter = std::find_if(_content.begin(), _content.end(), [digest](shared_ptr<const Content> c) { return c->digest() == digest; });
+ if (iter == _content.end()) {
+ return {};
+ }
+
+ return *iter;
+}
+
+
+shared_ptr<Content>
+ContentView::get_by_cpl_id(string cpl_id) const
+{
+ auto iter = std::find_if(
+ _content.begin(),
+ _content.end(),
+ [cpl_id](shared_ptr<const Content> c) {
+ if (auto dcp = dynamic_pointer_cast<const DCPContent>(c)) {
+ if (dcp->cpl() && *dcp->cpl() == cpl_id) {
+ return true;
+ }
+ }
+ return false;
+ });
+
+ if (iter == _content.end()) {
+ return {};
}
- return {};
+ return *iter;
}
diff --git a/src/wx/content_view.h b/src/wx/content_view.h
index 16ff5c463..703878d46 100644
--- a/src/wx/content_view.h
+++ b/src/wx/content_view.h
@@ -39,7 +39,8 @@ public:
std::shared_ptr<Content> selected () const;
void update ();
- std::shared_ptr<Content> get (std::string digest) const override;
+ std::shared_ptr<Content> get_by_digest(std::string digest) const override;
+ std::shared_ptr<Content> get_by_cpl_id(std::string cpl_id) const override;
private:
void add (std::shared_ptr<Content> content);