From 083f242875671739241ad8bf7e6f436959b5d677 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 7 Jan 2017 22:13:20 +0000 Subject: [PATCH] Prevent creation of a DCP with missing content or DCP content that needs KDMs/OVs. --- src/lib/film.cc | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/lib/film.cc b/src/lib/film.cc index 68266b4ec..b337c50de 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -288,6 +288,35 @@ Film::make_dcp () throw BadSettingError (_("name"), _("cannot contain slashes")); } + if (container() == 0) { + throw MissingSettingError (_("container")); + } + + if (content().empty()) { + throw runtime_error (_("you must add some content to the DCP before creating it.")); + } + + if (dcp_content_type() == 0) { + throw MissingSettingError (_("content type")); + } + + if (name().empty()) { + throw MissingSettingError (_("name")); + } + + BOOST_FOREACH (shared_ptr i, content ()) { + if (!i->paths_valid()) { + throw runtime_error (_("some of your content is missing.")); + } + shared_ptr dcp = dynamic_pointer_cast (i); + if (dcp && dcp->needs_kdm()) { + throw runtime_error (_("some of your content needs a KDM.")); + } + if (dcp && dcp->needs_assets()) { + throw runtime_error (_("some of your content needs an OV.")); + } + } + set_isdcf_date_today (); BOOST_FOREACH (string i, environment_info ()) { @@ -305,22 +334,6 @@ Film::make_dcp () } LOG_GENERAL ("J2K bandwidth %1", j2k_bandwidth()); - if (container() == 0) { - throw MissingSettingError (_("container")); - } - - if (content().empty()) { - throw runtime_error (_("You must add some content to the DCP before creating it")); - } - - if (dcp_content_type() == 0) { - throw MissingSettingError (_("content type")); - } - - if (name().empty()) { - throw MissingSettingError (_("name")); - } - JobManager::instance()->add (shared_ptr (new TranscodeJob (shared_from_this()))); } -- 2.30.2