From: Carl Hetherington Date: Thu, 1 Dec 2022 21:30:58 +0000 (+0100) Subject: Move UTC offset for KDMs from the cinema to the point of KDM creation (#2300). X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=2686d1b0f5007d0b6605688fa9f462b8835a3c6c;p=dcpomatic.git Move UTC offset for KDMs from the cinema to the point of KDM creation (#2300). --- diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 3b4b9d7b6..7388dbc2f 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -41,14 +41,6 @@ Cinema::Cinema (cxml::ConstNodePtr node) for (auto i: node->node_children("Email")) { emails.push_back (i->content ()); } - - if (node->optional_number_child("UTCOffset")) { - _utc_offset_hour = node->number_child("UTCOffset"); - } else { - _utc_offset_hour = node->optional_number_child("UTCOffsetHour").get_value_or (0); - } - - _utc_offset_minute = node->optional_number_child("UTCOffsetMinute").get_value_or (0); } /* This is necessary so that we can use shared_from_this in add_screen (which cannot be done from @@ -73,9 +65,6 @@ Cinema::as_xml (xmlpp::Element* parent) const parent->add_child("Notes")->add_child_text (notes); - parent->add_child("UTCOffsetHour")->add_child_text (raw_convert (_utc_offset_hour)); - parent->add_child("UTCOffsetMinute")->add_child_text (raw_convert (_utc_offset_minute)); - for (auto i: _screens) { i->as_xml (parent->add_child ("Screen")); } @@ -97,16 +86,3 @@ Cinema::remove_screen (shared_ptr s) } } -void -Cinema::set_utc_offset_hour (int h) -{ - DCPOMATIC_ASSERT (h >= -11 && h <= 12); - _utc_offset_hour = h; -} - -void -Cinema::set_utc_offset_minute (int m) -{ - DCPOMATIC_ASSERT (m >= 0 && m <= 59); - _utc_offset_minute = m; -} diff --git a/src/lib/cinema.h b/src/lib/cinema.h index 6c202a7bf..7008659d7 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -44,12 +44,10 @@ namespace dcpomatic { class Cinema : public std::enable_shared_from_this { public: - Cinema(std::string const & name_, std::vector const & e, std::string notes_, int utc_offset_hour, int utc_offset_minute) + Cinema(std::string const & name_, std::vector const & e, std::string notes_) : name (name_) , emails (e) , notes (notes_) - , _utc_offset_hour (utc_offset_hour) - , _utc_offset_minute (utc_offset_minute) {} explicit Cinema (cxml::ConstNodePtr); @@ -61,33 +59,14 @@ public: void add_screen (std::shared_ptr); void remove_screen (std::shared_ptr); - void set_utc_offset_hour (int h); - void set_utc_offset_minute (int m); - std::string name; std::vector emails; std::string notes; - int utc_offset_hour () const { - return _utc_offset_hour; - } - - int utc_offset_minute () const { - return _utc_offset_minute; - } - std::vector> screens() const { return _screens; } private: std::vector> _screens; - /** Offset such that the equivalent time in UTC can be determined - by subtracting the offset from the local time. - */ - int _utc_offset_hour; - /** Additional minutes to add to _utc_offset_hour if _utc_offset_hour is - positive, or to subtract if _utc_offset_hour is negative. - */ - int _utc_offset_minute; }; diff --git a/src/lib/dkdm_recipient.cc b/src/lib/dkdm_recipient.cc index c73379bed..c683151f2 100644 --- a/src/lib/dkdm_recipient.cc +++ b/src/lib/dkdm_recipient.cc @@ -65,29 +65,26 @@ kdm_for_dkdm_recipient ( shared_ptr film, boost::filesystem::path cpl, shared_ptr recipient, - boost::posix_time::ptime valid_from, - boost::posix_time::ptime valid_to + dcp::LocalTime valid_from, + dcp::LocalTime valid_to ) { if (!recipient->recipient) { return {}; } - dcp::LocalTime const begin(valid_from, dcp::UTCOffset(recipient->utc_offset_hour, recipient->utc_offset_minute)); - dcp::LocalTime const end (valid_to, dcp::UTCOffset(recipient->utc_offset_hour, recipient->utc_offset_minute)); - auto signer = Config::instance()->signer_chain(); if (!signer->valid()) { throw InvalidSignerError(); } - auto const decrypted_kdm = film->make_kdm(cpl, begin, end); + auto const decrypted_kdm = film->make_kdm(cpl, valid_from, valid_to); auto const kdm = decrypted_kdm.encrypt(signer, recipient->recipient.get(), {}, dcp::Formulation::MODIFIED_TRANSITIONAL_1, true, 0); dcp::NameFormat::Map name_values; name_values['f'] = kdm.content_title_text(); - name_values['b'] = begin.date() + " " + begin.time_of_day(true, false); - name_values['e'] = end.date() + " " + end.time_of_day(true, false); + name_values['b'] = valid_from.date() + " " + valid_from.time_of_day(true, false); + name_values['e'] = valid_to.date() + " " + valid_to.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); return make_shared(name_values, nullptr, recipient->emails, kdm); diff --git a/src/lib/dkdm_recipient.h b/src/lib/dkdm_recipient.h index 7a0fa0185..4015a0b7d 100644 --- a/src/lib/dkdm_recipient.h +++ b/src/lib/dkdm_recipient.h @@ -60,7 +60,7 @@ kdm_for_dkdm_recipient ( std::shared_ptr film, boost::filesystem::path cpl, std::shared_ptr recipient, - boost::posix_time::ptime valid_from, - boost::posix_time::ptime valid_to + dcp::LocalTime valid_from, + dcp::LocalTime valid_to ); diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index ddc77e771..112913042 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -62,8 +62,10 @@ help (std::function out) out (" -o, --output output file or directory"); out (" -K, --filename-format filename format for KDMs"); out (" -Z, --container-name-format filename format for ZIP containers"); - out (" -f, --valid-from