X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=691ef58dab1012f0b2dfb8c96d7b141e7b34ffc2;hp=82a00f4641d353ef9bae194cf70da595999795ab;hb=bc36ddea65fda2088f7e8fa98390e3feac07df84;hpb=c55763e650b12b96b97ef8630d3a5277c1237069 diff --git a/src/lib/film.cc b/src/lib/film.cc index 82a00f464..691ef58da 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -167,8 +167,9 @@ Film::Film (optional dir) set_isdcf_date_today (); _playlist_change_connection = _playlist->Change.connect (bind (&Film::playlist_change, this, _1)); - _playlist_order_changed_connection = _playlist->OrderChanged.connect (bind (&Film::playlist_order_changed, this)); + _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)); + _playlist_length_change_connection = _playlist->LengthChange.connect (bind(&Film::playlist_length_change, this)); if (dir) { /* Make state.directory a complete path without ..s (where possible) @@ -320,6 +321,10 @@ Film::make_dcp (bool gui, bool check) throw runtime_error (_("You must add some content to the DCP before creating it")); } + if (length() == DCPTime()) { + throw runtime_error (_("The DCP is empty, perhaps because all the content has zero length.")); + } + if (dcp_content_type() == 0) { throw MissingSettingError (_("content type")); } @@ -423,6 +428,7 @@ Film::metadata (bool with_content_paths) const BOOST_FOREACH (dcp::Rating i, _ratings) { i.as_xml (root->add_child("Rating")); } + root->add_child("ContentVersion")->add_child_text(_content_version); _playlist->as_xml (root->add_child ("Playlist"), with_content_paths); return doc; @@ -469,6 +475,10 @@ Film::read_metadata (optional path) path = file (metadata_file); } + if (!boost::filesystem::exists(*path)) { + throw FileNotFoundError(*path); + } + cxml::Document f ("Metadata"); f.read_file (path.get ()); @@ -566,6 +576,8 @@ Film::read_metadata (optional path) _ratings.push_back (dcp::Rating(i)); } + _content_version = f.optional_string_child("ContentVersion").get_value_or(""); + list notes; _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); @@ -1285,6 +1297,12 @@ Film::playlist_content_change (ChangeType type, weak_ptr c, int p, bool } } +void +Film::playlist_length_change () +{ + LengthChange (); +} + void Film::playlist_change (ChangeType type) { @@ -1759,6 +1777,13 @@ Film::set_ratings (vector r) _ratings = r; } +void +Film::set_content_version (string v) +{ + ChangeSignaller ch (this, CONTENT_VERSION); + _content_version = v; +} + optional Film::marker (dcp::Marker type) const {