summaryrefslogtreecommitdiff
path: root/src/lib/encode_cli.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-07 21:06:15 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-07 21:06:15 +0100
commitb41807b42b5f9d63c820e0c7b592d16250973fe9 (patch)
tree4f087fe54a445aa825a1c754d3b88c880dd02aa5 /src/lib/encode_cli.cc
parentc74ddc15f91203e29f6fe50739438347abe6b260 (diff)
Add convert-screen-db subcommand to dcpomatic2_cli.
This can convert a XML cinemas file to SQLite3.
Diffstat (limited to 'src/lib/encode_cli.cc')
-rw-r--r--src/lib/encode_cli.cc30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/lib/encode_cli.cc b/src/lib/encode_cli.cc
index 8bf1a4a26..80136d5ed 100644
--- a/src/lib/encode_cli.cc
+++ b/src/lib/encode_cli.cc
@@ -21,6 +21,7 @@
#include "ansi.h"
#include "audio_content.h"
+#include "cinema_list.h"
#include "config.h"
#include "cross.h"
#include "dcpomatic_log.h"
@@ -71,13 +72,14 @@ help(function <void (string)> out)
out(fmt::format("Syntax: {} [OPTION] [COMMAND] [<PARAMETER>]\n", program_name));
out("\nCommands:\n\n");
- out(" make-dcp <FILM> make DCP from the given film; default if no other command is specified\n");
- out(variant::insert_dcpomatic(" list-servers display a list of encoding servers that {} can use (until Ctrl-C)\n"));
- out(" dump <FILM> show a summary of the film's settings\n");
+ out(" make-dcp <FILM> make DCP from the given film; default if no other command is specified\n");
+ out(variant::insert_dcpomatic(" list-servers display a list of encoding servers that {} can use (until Ctrl-C)\n"));
+ out(" dump <FILM> show a summary of the film's settings\n");
+ out(" convert-screen-db <in> <out> convert a given XML screen database to SQLite\n");
#ifdef DCPOMATIC_GROK
- out(" config-params list the parameters that can be set with `config`\n");
- out(" config <PARAMETER> <VALUE> set a DCP-o-matic configuration value\n");
- out(" list-gpus list available GPUs\n");
+ out(" config-params list the parameters that can be set with `config`\n");
+ out(" config <PARAMETER> <VALUE> set a DCP-o-matic configuration value\n");
+ out(" list-gpus list available GPUs\n");
#endif
out("\nOptions:\n\n");
@@ -103,6 +105,7 @@ help(function <void (string)> out)
out("\ne.g.\n");
out(fmt::format("\n {} -t 4 make-dcp my_great_movie\n", program_name));
out(fmt::format("\n {} config grok-licence 12345ABCD\n", program_name));
+ out(fmt::format("\n {} convert-screen-db database.xml database.sqlite3", program_name));
out("\n");
}
@@ -388,7 +391,8 @@ encode_cli(int argc, char* argv[], function<void (string)> out, function<void ()
"config",
"list-gpus"
#else
- "dump"
+ "dump",
+ "convert-screen-db"
#endif
};
@@ -450,6 +454,18 @@ encode_cli(int argc, char* argv[], function<void (string)> out, function<void ()
}
#endif
+ if (command == "convert-screen-db") {
+ if (optind < argc - 1) {
+ string const input = argv[optind++];
+ string const output = argv[optind++];
+ CinemaList cinemas(output);
+ cinemas.read_legacy_file(input);
+ } else {
+ return fmt::format("Missing parameter: use {} config <input-xml-file> <output-sqlite3-file>", program_name);
+ }
+ return {};
+ }
+
if (config) {
State::override_path = *config;
}