diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-08-17 22:16:43 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-08-17 22:16:43 +0200 |
| commit | 924f4edb20d14bc697956254951fb87513cf2e19 (patch) | |
| tree | 0ede1ff0951e1b46196e546a03d522f54ddda033 /src/lib | |
| parent | 2bbc9ce4ca245d5666929a542e6d07d9ef833c13 (diff) | |
Add defaults for facility, studio, chain, distributor (#2075).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 11 | ||||
| -rw-r--r-- | src/lib/config.h | 9 | ||||
| -rw-r--r-- | src/lib/film.cc | 14 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index a8653a10c..ed00d274b 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -104,6 +104,7 @@ Config::set_defaults () _default_j2k_bandwidth = 150000000; _default_audio_delay = 0; _default_interop = false; + _default_metadata.clear (); _upload_after_make_dcp = false; _mail_server = ""; _mail_port = 25; @@ -313,6 +314,11 @@ try _default_j2k_bandwidth = f.optional_number_child<int>("DefaultJ2KBandwidth").get_value_or (200000000); _default_audio_delay = f.optional_number_child<int>("DefaultAudioDelay").get_value_or (0); _default_interop = f.optional_bool_child("DefaultInterop").get_value_or (false); + + for (auto const& i: f.node_children("DefaultMetadata")) { + _default_metadata[i->string_attribute("key")] = i->content(); + } + _default_kdm_directory = f.optional_string_child("DefaultKDMDirectory"); /* Read any cinemas that are still lying around in the config file @@ -690,6 +696,11 @@ Config::write_config () const root->add_child("DefaultAudioDelay")->add_child_text (raw_convert<string> (_default_audio_delay)); /* [XML] DefaultInterop 1 to default new films to Interop, 0 for SMPTE. */ root->add_child("DefaultInterop")->add_child_text (_default_interop ? "1" : "0"); + for (auto const& i: _default_metadata) { + auto c = root->add_child("DefaultMetadata"); + c->set_attribute("key", i.first); + c->add_child_text(i.second); + } if (_default_kdm_directory) { /* [XML:opt] DefaultKDMDirectory Default directory to write KDMs to. */ root->add_child("DefaultKDMDirectory")->add_child_text (_default_kdm_directory->string ()); diff --git a/src/lib/config.h b/src/lib/config.h index 5b64922e6..46bd390cc 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -220,6 +220,10 @@ public: return _default_interop; } + std::map<std::string, std::string> default_metadata () const { + return _default_metadata; + } + bool upload_after_make_dcp () { return _upload_after_make_dcp; } @@ -699,6 +703,10 @@ public: maybe_set (_default_interop, i); } + void set_default_metadata (std::map<std::string, std::string> const& metadata) { + maybe_set (_default_metadata, metadata); + } + void set_upload_after_make_dcp (bool u) { maybe_set (_upload_after_make_dcp, u); } @@ -1180,6 +1188,7 @@ private: int _default_j2k_bandwidth; int _default_audio_delay; bool _default_interop; + std::map<std::string, std::string> _default_metadata; /** Default directory to offer to write KDMs to; if it's not set, the home directory will be offered. */ diff --git a/src/lib/film.cc b/src/lib/film.cc index acfea9991..94e996e19 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -176,6 +176,20 @@ Film::Film (optional<boost::filesystem::path> dir) { set_isdcf_date_today (); + auto metadata = Config::instance()->default_metadata(); + if (metadata.find("chain") != metadata.end()) { + _chain = metadata["chain"]; + } + if (metadata.find("distributor") != metadata.end()) { + _distributor = metadata["distributor"]; + } + if (metadata.find("facility") != metadata.end()) { + _facility = metadata["facility"]; + } + if (metadata.find("studio") != metadata.end()) { + _studio = metadata["studio"]; + } + _playlist_change_connection = _playlist->Change.connect (bind (&Film::playlist_change, this, _1)); _playlist_order_changed_connection = _playlist->OrderChange.connect (bind (&Film::playlist_order_changed, this)); _playlist_content_change_connection = _playlist->ContentChange.connect (bind (&Film::playlist_content_change, this, _1, _2, _3, _4)); |
