Add -d option to dcpomatic_cli to dump the DCP path to stdout after creation.
authorCarl Hetherington <cth@carlh.net>
Tue, 16 Feb 2016 11:31:20 +0000 (11:31 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 Feb 2016 11:31:20 +0000 (11:31 +0000)
ChangeLog
src/tools/dcpomatic_cli.cc

index 3191b89b567e495615aeea0849b64591fd7f5300..fce336dfc81c220bb8eb83b92bf226a3b74f7788 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-02-16  Carl Hetherington  <cth@carlh.net>
 
+       * Add option to dcpomatic_cli to echo the
+       created DCP's path to stdout (#794).
+
        * Add option to auto-upload to TMS (#794).
 
        * Version 2.6.22 released.
index 80e10daaf08299a7483ff551266b2c0522563dce..7ab6d284d84650e0bedd3f5674519979fb002912 100644 (file)
@@ -61,6 +61,7 @@ help (string n)
             << "  -j, --json <port>  run a JSON server on the specified port\n"
             << "  -k, --keep-going   keep running even when the job is complete\n"
             << "  -s, --servers      just display a list of encoding servers that DCP-o-matic is configured to use; don't encode\n"
+            << "  -d, --dcp-path     echo DCP's path to stdout on successful completion (implies -n)\n"
             << "      --dump         just dump a summary of the film's settings; don't encode\n"
             << "\n"
             << "<FILM> is the film directory.\n";
@@ -179,6 +180,7 @@ main (int argc, char* argv[])
        bool keep_going = false;
        bool dump = false;
        bool servers = false;
+       bool dcp_path = false;
 
        int option_index = 0;
        while (true) {
@@ -191,12 +193,13 @@ main (int argc, char* argv[])
                        { "json", required_argument, 0, 'j'},
                        { "keep-going", no_argument, 0, 'k' },
                        { "servers", no_argument, 0, 's' },
+                       { "dcp-path", no_argument, 0, 'd' },
                        /* Just using A, B, C ... from here on */
                        { "dump", no_argument, 0, 'A' },
                        { 0, 0, 0, 0 }
                };
 
-               int c = getopt_long (argc, argv, "vhfnrj:kAs", long_options, &option_index);
+               int c = getopt_long (argc, argv, "vhfnrj:kAsd", long_options, &option_index);
 
                if (c == -1) {
                        break;
@@ -230,6 +233,10 @@ main (int argc, char* argv[])
                case 's':
                        servers = true;
                        break;
+               case 'd':
+                       dcp_path = true;
+                       progress = false;
+                       break;
                }
        }
 
@@ -355,5 +362,9 @@ main (int argc, char* argv[])
 
        EncodeServerFinder::drop ();
 
+       if (dcp_path && !error) {
+               cout << film->dir (film->dcp_name (false)).string() << "\n";
+       }
+
        return error ? EXIT_FAILURE : EXIT_SUCCESS;
 }