diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-01 00:48:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-01 00:48:15 +0100 |
| commit | 1d022220899c63e2cae0a2a9a81f6c6db955a23d (patch) | |
| tree | fdf436255ae717e6269d98626e9d45824fc77e82 /src/lib | |
| parent | 9c01623c3038b978ba732de2ad147d29fad60afe (diff) | |
Simplify NameFormat stuff.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cinema_kdms.cc | 7 | ||||
| -rw-r--r-- | src/lib/cinema_kdms.h | 6 | ||||
| -rw-r--r-- | src/lib/config.cc | 11 | ||||
| -rw-r--r-- | src/lib/config.h | 15 | ||||
| -rw-r--r-- | src/lib/kdm_filename_format.cc | 38 | ||||
| -rw-r--r-- | src/lib/kdm_filename_format.h | 33 | ||||
| -rw-r--r-- | src/lib/screen_kdm.cc | 2 | ||||
| -rw-r--r-- | src/lib/screen_kdm.h | 4 | ||||
| -rw-r--r-- | src/lib/send_kdm_email_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/send_kdm_email_job.h | 6 | ||||
| -rw-r--r-- | src/lib/wscript | 1 |
11 files changed, 25 insertions, 100 deletions
diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc index 78e7c5ace..299cdf94e 100644 --- a/src/lib/cinema_kdms.cc +++ b/src/lib/cinema_kdms.cc @@ -27,7 +27,6 @@ #include "emailer.h" #include "compose.hpp" #include "log.h" -#include "kdm_filename_format.h" #include <zip.h> #include <boost/foreach.hpp> @@ -40,7 +39,7 @@ using std::runtime_error; using boost::shared_ptr; void -CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, KDMFilenameFormat name_format, dcp::NameFormat::Map name_values) const +CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat name_format, dcp::NameFormat::Map name_values) const { int error; struct zip* zip = zip_open (zip_file.string().c_str(), ZIP_CREATE | ZIP_EXCL, &error); @@ -119,7 +118,7 @@ void CinemaKDMs::write_zip_files ( list<CinemaKDMs> cinema_kdms, boost::filesystem::path directory, - KDMFilenameFormat name_format, + dcp::NameFormat name_format, dcp::NameFormat::Map name_values ) { @@ -140,7 +139,7 @@ CinemaKDMs::write_zip_files ( void CinemaKDMs::email ( list<CinemaKDMs> cinema_kdms, - KDMFilenameFormat name_format, + dcp::NameFormat name_format, dcp::NameFormat::Map name_values, string cpl_name, shared_ptr<Log> log diff --git a/src/lib/cinema_kdms.h b/src/lib/cinema_kdms.h index 826b93806..e29fa5cbd 100644 --- a/src/lib/cinema_kdms.h +++ b/src/lib/cinema_kdms.h @@ -27,20 +27,20 @@ class Log; class CinemaKDMs { public: - void make_zip_file (boost::filesystem::path zip_file, KDMFilenameFormat name_format, dcp::NameFormat::Map name_values) const; + void make_zip_file (boost::filesystem::path zip_file, dcp::NameFormat name_format, dcp::NameFormat::Map name_values) const; static std::list<CinemaKDMs> collect (std::list<ScreenKDM> kdms); static void write_zip_files ( std::list<CinemaKDMs> cinema_kdms, boost::filesystem::path directory, - KDMFilenameFormat name_format, + dcp::NameFormat name_format, dcp::NameFormat::Map name_values ); static void email ( std::list<CinemaKDMs> cinema_kdms, - KDMFilenameFormat name_format, + dcp::NameFormat name_format, dcp::NameFormat::Map name_values, std::string cpl_name, boost::shared_ptr<Log> log diff --git a/src/lib/config.cc b/src/lib/config.cc index d332c805a..5dbbd692e 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -30,8 +30,7 @@ #include "util.h" #include "cross.h" #include "raw_convert.h" -#include "kdm_filename_format.h" -#include <dcp/filename_format.h> +#include <dcp/name_format.h> #include <dcp/colour_matrix.h> #include <dcp/certificate_chain.h> #include <libcxml/cxml.h> @@ -110,8 +109,8 @@ Config::set_defaults () #endif _cinemas_file = path ("cinemas.xml"); _show_hints_before_make_dcp = true; - _kdm_filename_format = KDMFilenameFormat ("KDM %f %c %s"); - _dcp_filename_format = dcp::FilenameFormat ("%t_%i"); + _kdm_filename_format = dcp::NameFormat ("KDM %f %c %s"); + _dcp_filename_format = dcp::NameFormat ("%t_%i"); _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -294,8 +293,8 @@ try _cinemas_file = f.optional_string_child("CinemasFile").get_value_or (path ("cinemas.xml").string ()); _show_hints_before_make_dcp = f.optional_bool_child("ShowHintsBeforeMakeDCP").get_value_or (true); - _kdm_filename_format = KDMFilenameFormat (f.optional_string_child("KDMFilenameFormat").get_value_or ("KDM %f %c %s")); - _dcp_filename_format = dcp::FilenameFormat (f.optional_string_child("DCPFilenameFormat").get_value_or ("%t_%i.mxf")); + _kdm_filename_format = dcp::NameFormat (f.optional_string_child("KDMFilenameFormat").get_value_or ("KDM %f %c %s")); + _dcp_filename_format = dcp::NameFormat (f.optional_string_child("DCPFilenameFormat").get_value_or ("%t_%i.mxf")); /* Replace any cinemas from config.xml with those from the configured file */ if (boost::filesystem::exists (_cinemas_file)) { diff --git a/src/lib/config.h b/src/lib/config.h index 0de71be51..3a0308462 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -26,9 +26,8 @@ #define DCPOMATIC_CONFIG_H #include "isdcf_metadata.h" -#include "kdm_filename_format.h" #include "types.h" -#include <dcp/filename_format.h> +#include <dcp/name_format.h> #include <dcp/certificate_chain.h> #include <dcp/encrypted_kdm.h> #include <boost/shared_ptr.hpp> @@ -268,11 +267,11 @@ public: return _show_hints_before_make_dcp; } - KDMFilenameFormat kdm_filename_format () const { + dcp::NameFormat kdm_filename_format () const { return _kdm_filename_format; } - dcp::FilenameFormat dcp_filename_format () const { + dcp::NameFormat dcp_filename_format () const { return _dcp_filename_format; } @@ -483,11 +482,11 @@ public: maybe_set (_show_hints_before_make_dcp, s); } - void set_kdm_filename_format (KDMFilenameFormat n) { + void set_kdm_filename_format (dcp::NameFormat n) { maybe_set (_kdm_filename_format, n); } - void set_dcp_filename_format (dcp::FilenameFormat n) { + void set_dcp_filename_format (dcp::NameFormat n) { maybe_set (_dcp_filename_format, n); } @@ -602,8 +601,8 @@ private: std::vector<dcp::EncryptedKDM> _dkdms; boost::filesystem::path _cinemas_file; bool _show_hints_before_make_dcp; - KDMFilenameFormat _kdm_filename_format; - dcp::FilenameFormat _dcp_filename_format; + dcp::NameFormat _kdm_filename_format; + dcp::NameFormat _dcp_filename_format; /** Singleton instance, or 0 */ static Config* _instance; diff --git a/src/lib/kdm_filename_format.cc b/src/lib/kdm_filename_format.cc deleted file mode 100644 index 20e8298fe..000000000 --- a/src/lib/kdm_filename_format.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#include "kdm_filename_format.h" - -using std::string; - -KDMFilenameFormat::KDMFilenameFormat (string specification) - : NameFormat (specification) -{ - /* film name */ - add ('f'); - /* cinema */ - add ('c'); - /* screen */ - add ('s'); - /* from date/time */ - add ('b'); - /* to date/time */ - add ('e'); -} diff --git a/src/lib/kdm_filename_format.h b/src/lib/kdm_filename_format.h deleted file mode 100644 index b96ac34ae..000000000 --- a/src/lib/kdm_filename_format.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#ifndef DCPOMATIC_KDM_FILENAME_FORMAT -#define DCPOMATIC_KDM_FILENAME_FORMAT - -#include <dcp/name_format.h> - -class KDMFilenameFormat : public dcp::NameFormat -{ -public: - KDMFilenameFormat () {} - KDMFilenameFormat (std::string specification); -}; - -#endif diff --git a/src/lib/screen_kdm.cc b/src/lib/screen_kdm.cc index 9cb831622..129e64aee 100644 --- a/src/lib/screen_kdm.cc +++ b/src/lib/screen_kdm.cc @@ -35,7 +35,7 @@ operator== (ScreenKDM const & a, ScreenKDM const & b) } void -ScreenKDM::write_files (list<ScreenKDM> screen_kdms, boost::filesystem::path directory, KDMFilenameFormat name_format, dcp::NameFormat::Map name_values) +ScreenKDM::write_files (list<ScreenKDM> screen_kdms, boost::filesystem::path directory, dcp::NameFormat name_format, dcp::NameFormat::Map name_values) { /* Write KDMs to the specified directory */ BOOST_FOREACH (ScreenKDM const & i, screen_kdms) { diff --git a/src/lib/screen_kdm.h b/src/lib/screen_kdm.h index 227526449..60486c259 100644 --- a/src/lib/screen_kdm.h +++ b/src/lib/screen_kdm.h @@ -21,8 +21,8 @@ #ifndef DCPOMATIC_SCREEN_KDM_H #define DCPOMATIC_SCREEN_KDM_H -#include "kdm_filename_format.h" #include <dcp/encrypted_kdm.h> +#include <dcp/name_format.h> #include <boost/shared_ptr.hpp> class Screen; @@ -38,7 +38,7 @@ public: static void write_files ( std::list<ScreenKDM> screen_kdms, boost::filesystem::path directory, - KDMFilenameFormat name_format, dcp::NameFormat::Map name_values + dcp::NameFormat name_format, dcp::NameFormat::Map name_values ); boost::shared_ptr<Screen> screen; diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index b06704545..642939462 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -33,7 +33,7 @@ using boost::shared_ptr; /** @param log Log to write to, or 0 */ SendKDMEmailJob::SendKDMEmailJob ( list<CinemaKDMs> cinema_kdms, - KDMFilenameFormat name_format, + dcp::NameFormat name_format, dcp::NameFormat::Map name_values, string cpl_name, shared_ptr<Log> log diff --git a/src/lib/send_kdm_email_job.h b/src/lib/send_kdm_email_job.h index 17b2db89c..c2916f69d 100644 --- a/src/lib/send_kdm_email_job.h +++ b/src/lib/send_kdm_email_job.h @@ -19,8 +19,8 @@ */ #include "job.h" -#include "kdm_filename_format.h" #include <dcp/types.h> +#include <dcp/name_format.h> #include <boost/filesystem.hpp> class Screen; @@ -32,7 +32,7 @@ class SendKDMEmailJob : public Job public: SendKDMEmailJob ( std::list<CinemaKDMs> cinema_kdms, - KDMFilenameFormat name_format, + dcp::NameFormat name_format, dcp::NameFormat::Map name_values, std::string cpl_name, boost::shared_ptr<Log> log @@ -43,7 +43,7 @@ public: void run (); private: - KDMFilenameFormat _name_format; + dcp::NameFormat _name_format; dcp::NameFormat::Map _name_values; std::string _cpl_name; std::list<CinemaKDMs> _cinema_kdms; diff --git a/src/lib/wscript b/src/lib/wscript index 6e937c26f..9883f31d6 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -94,7 +94,6 @@ sources = """ job.cc job_manager.cc json_server.cc - kdm_filename_format.cc log.cc log_entry.cc magick_image_proxy.cc |
