From 16557827b252bd653b15eead479ec5699eda7360 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 19 Nov 2023 21:34:56 +0100 Subject: Add a dialog to show which screens have potentially-problematic certificate validity periods when making KDMs (#2645). --- src/lib/kdm_util.cc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/lib/kdm_util.cc') diff --git a/src/lib/kdm_util.cc b/src/lib/kdm_util.cc index bf112ce11..dcfd1fe67 100644 --- a/src/lib/kdm_util.cc +++ b/src/lib/kdm_util.cc @@ -35,7 +35,13 @@ using boost::optional; KDMCertificatePeriod -check_kdm_and_certificate_validity_periods(dcp::Certificate const& recipient, dcp::LocalTime kdm_from, dcp::LocalTime kdm_to) +check_kdm_and_certificate_validity_periods( + string const& cinema_name, + string const& screen_name, + dcp::Certificate const& recipient, + dcp::LocalTime kdm_from, + dcp::LocalTime kdm_to + ) { auto overlaps = [](dcp::LocalTime from_a, dcp::LocalTime to_a, dcp::LocalTime from_b, dcp::LocalTime to_b) { return std::max(from_a, from_b) < std::min(to_a, to_b); @@ -45,16 +51,26 @@ check_kdm_and_certificate_validity_periods(dcp::Certificate const& recipient, dc return bigger_from <= smaller_from && bigger_to >= smaller_to; }; + KDMCertificatePeriod period( + cinema_name, + screen_name, + recipient.not_before(), + recipient.not_after() + ); + if (contains(recipient.not_before(), recipient.not_after(), kdm_from, kdm_to)) { - return KDMCertificatePeriod::KDM_WITHIN_CERTIFICATE; + period.overlap = KDMCertificateOverlap::KDM_WITHIN_CERTIFICATE; + return period; } if (overlaps(recipient.not_before(), recipient.not_after(), kdm_from, kdm_to)) { /* The KDM overlaps the certificate validity: maybe not the end of the world */ - return KDMCertificatePeriod::KDM_OVERLAPS_CERTIFICATE; + period.overlap = KDMCertificateOverlap::KDM_OVERLAPS_CERTIFICATE; + return period; } else { /* The KDM validity is totally outside the certificate validity: bad news */ - return KDMCertificatePeriod::KDM_OUTSIDE_CERTIFICATE; + period.overlap = KDMCertificateOverlap::KDM_OUTSIDE_CERTIFICATE; + return period; } } -- cgit v1.2.3