Add config option to allow long ISDCF name parts.
[dcpomatic.git] / src / lib / film.cc
index 25a135488f2c9981ea623b5345ded1552ed04d0e..4ed1f0f8bd3079572fda3f9850bcd8378d2c8d28 100644 (file)
@@ -495,7 +495,12 @@ Film::write_metadata ()
 {
        DCPOMATIC_ASSERT (directory());
        boost::filesystem::create_directories (directory().get());
-       metadata()->write_to_file_formatted(file(metadata_file).string());
+       auto const filename = file(metadata_file);
+       try {
+               metadata()->write_to_file_formatted(filename.string());
+       } catch (xmlpp::exception& e) {
+               throw FileError(String::compose("Could not write metadata file (%1)", e.what()), filename);
+       }
        set_dirty (false);
 }
 
@@ -858,7 +863,7 @@ Film::isdcf_name (bool if_created_now) const
                }
        }
 
-       fixed_name = fixed_name.substr(0, 14);
+       fixed_name = fixed_name.substr(0, Config::instance()->isdcf_name_part_length());
 
        isdcf_name += fixed_name;
 
@@ -1012,7 +1017,7 @@ Film::isdcf_name (bool if_created_now) const
        }
 
        if (find_if(content_list.begin(), content_list.end(), [](shared_ptr<Content> c) { return static_cast<bool>(c->atmos); }) != content_list.end()) {
-               isdcf_name += "-ATMOS";
+               isdcf_name += "-IAB";
        }
 
        isdcf_name += "_" + resolution_to_string (_resolution);