+help ()
+{
+ cerr << "Syntax: " << program_name << " [OPTION] [<FILM>]\n"
+ " -h, --help show this help\n"
+ " -o, --output output file or directory\n"
+ " -f, --valid-from valid from time (in local time zone) (e.g. \"2013-09-28 01:41:51\") or \"now\"\n"
+ " -t, --valid-to valid to time (in local time zone) (e.g. \"2014-09-28 01:41:51\")\n"
+ " -d, --valid-duration valid duration (e.g. \"1 day\", \"4 hours\", \"2 weeks\")\n"
+ " --formulation modified-transitional-1, dci-any or dci-specific [default modified-transitional-1]\n"
+ " -z, --zip ZIP each cinema's KDMs into its own file\n"
+ " -v, --verbose be verbose\n"
+ " -c, --cinema specify a cinema, either by name or email address\n"
+ " --cinemas list known cinemas from the DCP-o-matic settings\n"
+ " --certificate file containing projector certificate\n\n"
+ "For example:\n\n"
+ "Create KDMs for my_great_movie to play in all of Fred's Cinema's screens for the next two weeks and zip them up.\n"
+ "(Fred's Cinema must have been set up in DCP-o-matic's KDM window)\n\n"
+ "\tdcpomatic_kdm -c \"Fred's Cinema\" -f now -d \"2 weeks\" -z my_great_movie\n\n";
+}
+
+static void
+error (string m)
+{
+ cerr << program_name << ": " << m << "\n";
+ exit (EXIT_FAILURE);
+}
+
+static boost::posix_time::ptime
+time_from_string (string t)