#ifdef DCPOMATIC_VARIANT_SWAROOP
_player_background_image = boost::none;
_kdm_server_url = "http://localhost:8000/{CPL}";
- _player_watermark = boost::none;
+ _player_watermark_theatre = "";
+ _player_watermark_period = 1;
+ _player_watermark_duration = 50;
#endif
_allowed_dcp_frame_rates.clear ();
Config::read ()
try
{
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ if (geteuid() == 0) {
+ /* Take ownership of the config file if we're root */
+ chown (config_file().string().c_str(), 0, 0);
+ chmod (config_file().string().c_str(), 0644);
+ }
+#endif
+
cxml::Document f ("Config");
f.read_file (config_file ());
#ifdef DCPOMATIC_VARIANT_SWAROOP
_player_background_image = f.optional_string_child("PlayerBackgroundImage");
_kdm_server_url = f.optional_string_child("KDMServerURL").get_value_or("http://localhost:8000/{CPL}");
- _player_watermark = f.optional_string_child("PlayerWatermark");
+ _player_watermark_theatre = f.optional_string_child("PlayerWatermarkTheatre").get_value_or("");
+ _player_watermark_period = f.optional_number_child<int>("PlayerWatermarkPeriod").get_value_or(1);
+ _player_watermark_duration = f.optional_number_child<int>("PlayerWatermarkDuration").get_value_or(150);
+ BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("RequiredMonitor")) {
+ _required_monitors.push_back(Monitor(i));
+ }
#endif
/* Replace any cinemas from config.xml with those from the configured file */
root->add_child("PlayerBackgroundImage")->add_child_text(_player_background_image->string());
}
root->add_child("KDMServerURL")->add_child_text(_kdm_server_url);
- if (_player_watermark) {
- root->add_child("PlayerWatermark")->add_child_text(_player_watermark->string());
+ root->add_child("PlayerWatermarkTheatre")->add_child_text(_player_watermark_theatre);
+ root->add_child("PlayerWatermarkPeriod")->add_child_text(raw_convert<string>(_player_watermark_period));
+ root->add_child("PlayerWatermarkDuration")->add_child_text(raw_convert<string>(_player_watermark_duration));
+ BOOST_FOREACH (Monitor i, _required_monitors) {
+ i.as_xml(root->add_child("RequiredMonitor"));
}
#endif
boost::filesystem::copy_file (config_file(), new_file, boost::filesystem::copy_option::overwrite_if_exists);
link (new_file);
}
+
+bool
+Config::have_write_permission () const
+{
+ FILE* f = fopen_boost (config_file(), "r+");
+ if (!f) {
+ return false;
+ }
+
+ fclose (f);
+ return true;
+}