From f40583c385c17dfc6ed13eff3ded5637cbf57089 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 26 Oct 2012 13:05:21 +0100 Subject: [PATCH] Try to fix name problems if an encode crosses midnight. --- src/lib/film.cc | 12 ++++++++++-- src/lib/film.h | 4 ++++ src/wx/film_editor.cc | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lib/film.cc b/src/lib/film.cc index 75dbfee3d..81de2b518 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -128,6 +128,7 @@ Film::Film (string d, bool must_exist) read_metadata (); _log = new FileLog (file ("log")); + set_dci_date_today (); } Film::Film (Film const & o) @@ -221,6 +222,8 @@ Film::j2k_dir () const void Film::make_dcp (bool transcode) { + set_dci_date_today (); + if (dcp_name().find ("/") != string::npos) { throw BadSettingError ("name", "cannot contain slashes"); } @@ -806,8 +809,7 @@ Film::dci_name () const d << _studio << "_"; } - boost::gregorian::date today = boost::gregorian::day_clock::local_day (); - d << boost::gregorian::to_iso_string (today) << "_"; + d << boost::gregorian::to_iso_string (_dci_date) << "_"; if (!_facility.empty ()) { d << _facility << "_"; @@ -1355,3 +1357,9 @@ Film::audio_channels () const return _audio_streams[_audio_stream].channels (); } + +void +Film::set_dci_date_today () +{ + _dci_date = boost::gregorian::day_clock::local_day (); +} diff --git a/src/lib/film.h b/src/lib/film.h index b2daf0f22..f3ddc652a 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -106,6 +106,8 @@ public: int audio_channels () const; + void set_dci_date_today (); + enum Property { NONE, NAME, @@ -390,6 +392,8 @@ private: /** Any running ExamineContentJob, or 0 */ boost::shared_ptr _examine_content_job; + boost::gregorian::date _dci_date; + std::string thumb_file_for_frame (int) const; std::string thumb_base_for_frame (int) const; void signal_changed (Property); diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 3e5079cc5..3e5308a39 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -377,6 +377,7 @@ FilmEditor::name_changed (wxCommandEvent &) _film->set_name (string (_name->GetValue().mb_str())); _ignore_changes = Film::NONE; + _film->set_dci_date_today (); _dcp_name->SetLabel (std_to_wx (_film->dcp_name ())); } -- 2.30.2