diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-09 13:44:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-09 13:44:43 +0100 |
| commit | 0f42e807a707249cd1a60fa6e476cb47a4147c5a (patch) | |
| tree | 62307e5723e9787501ea05b76f5ded2b237c7075 /src/lib | |
| parent | 89ae13638097f259f3e50b4b61068dd23451107d (diff) | |
Basica save-as (duplicate) (#746).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 14 | ||||
| -rw-r--r-- | src/lib/film.h | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 04ff00250..36221fb9a 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -98,6 +98,8 @@ using dcp::raw_convert; #define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); #define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL); +string const Film::metadata_file = "metadata.xml"; + /* 5 -> 6 * AudioMapping XML changed. * 6 -> 7 @@ -399,7 +401,7 @@ Film::write_metadata () const DCPOMATIC_ASSERT (directory()); boost::filesystem::create_directories (directory().get()); shared_ptr<xmlpp::Document> doc = metadata (); - doc->write_to_file_formatted (file("metadata.xml").string ()); + doc->write_to_file_formatted (file(metadata_file).string ()); _dirty = false; } @@ -419,11 +421,11 @@ list<string> Film::read_metadata (optional<boost::filesystem::path> path) { if (!path) { - if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file ("metadata.xml"))) { + if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file (metadata_file))) { throw runtime_error (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version. You will need to create a new Film, re-add your content and set it up again. Sorry!")); } - path = file ("metadata.xml"); + path = file (metadata_file); } cxml::Document f ("Metadata"); @@ -1575,3 +1577,9 @@ Film::speed_up_range (int dcp_frame_rate) const { return _playlist->speed_up_range (dcp_frame_rate); } + +void +Film::copy_from (shared_ptr<const Film> film) +{ + read_metadata (film->file (metadata_file)); +} diff --git a/src/lib/film.h b/src/lib/film.h index fdd4674d5..ec64c3913 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -96,6 +96,8 @@ public: void write_template (boost::filesystem::path path) const; boost::shared_ptr<xmlpp::Document> metadata (bool with_content_paths = true) const; + void copy_from (boost::shared_ptr<const Film> film); + std::string isdcf_name (bool if_created_now) const; std::string dcp_name (bool if_created_now = false) const; @@ -337,6 +339,8 @@ private: void maybe_add_content (boost::weak_ptr<Job>, boost::weak_ptr<Content>); void audio_analysis_finished (); + static std::string const metadata_file; + /** Log to write to */ boost::shared_ptr<Log> _log; boost::shared_ptr<Playlist> _playlist; |
