2 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <libdcp/certificates.h>
26 using boost::shared_ptr;
31 cerr << "Syntax: " << n << " [OPTION] <FILM>\n"
32 << " -h, --help show this help\n"
33 << " -o, --output output filename\n"
34 << " -f, --valid-from valid from time (e.g. \"2013-09-28 01:41:51\")\n"
35 << " -t, --valid-to valid to time (e.g. \"2014-09-28 01:41:51\")\n"
36 << " -c, --certificate file containing projector certificate\n";
39 int main (int argc, char* argv[])
44 string certificate_file;
48 static struct option long_options[] = {
49 { "help", no_argument, 0, 'h'},
50 { "output", required_argument, 0, 'o'},
51 { "valid-from", required_argument, 0, 'f'},
52 { "valid-to", required_argument, 0, 't'},
53 { "certificate", required_argument, 0, 'c' },
57 int c = getopt_long (argc, argv, "ho:f:t:c:", long_options, &option_index);
77 certificate_file = optarg;
87 string const film_dir = argv[optind];
91 shared_ptr<Film> film;
93 film.reset (new Film (film_dir));
94 film->read_metadata ();
95 } catch (std::exception& e) {
96 cerr << argv[0] << ": error reading film `" << film_dir << "' (" << e.what() << ")\n";
100 cerr << "reading " << certificate_file << "\n";
101 shared_ptr<libdcp::Certificate> certificate (new libdcp::Certificate (boost::filesystem::path (certificate_file)));
102 libdcp::KDM kdm = film->make_kdm (
103 certificate, boost::posix_time::time_from_string (valid_from), boost::posix_time::time_from_string (valid_to)