projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe9d2a2
)
Simplification of name format stuff.
author
Carl Hetherington
<cth@carlh.net>
Fri, 29 Jul 2016 15:21:40 +0000
(16:21 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 29 Jul 2016 15:21:40 +0000
(16:21 +0100)
12 files changed:
cscript
patch
|
blob
|
history
src/lib/cinema_kdms.cc
patch
|
blob
|
history
src/lib/kdm_name_format.cc
patch
|
blob
|
history
src/lib/screen_kdm.cc
patch
|
blob
|
history
src/lib/send_kdm_email_job.cc
patch
|
blob
|
history
src/lib/util.cc
patch
|
blob
|
history
src/tools/dcpomatic_kdm.cc
patch
|
blob
|
history
src/tools/dcpomatic_kdm_cli.cc
patch
|
blob
|
history
src/wx/config_dialog.cc
patch
|
blob
|
history
src/wx/kdm_dialog.cc
patch
|
blob
|
history
src/wx/kdm_output_panel.cc
patch
|
blob
|
history
src/wx/name_format_editor.h
patch
|
blob
|
history
diff --git
a/cscript
b/cscript
index 1081f661d447d50ad3dc553eda984c3ac6598e5f..2ce67238587634bef7c57a64a21cdebd5a57f883 100644
(file)
--- a/
cscript
+++ b/
cscript
@@
-237,7
+237,7
@@
def dependencies(target):
ffmpeg_options = {}
return (('ffmpeg-cdist', '1d4a1a4', ffmpeg_options),
ffmpeg_options = {}
return (('ffmpeg-cdist', '1d4a1a4', ffmpeg_options),
- ('libdcp', '
e02bf26
'),
+ ('libdcp', '
7e9ad08
'),
('libsub', '067c21c'))
def configure_options(target):
('libsub', '067c21c'))
def configure_options(target):
diff --git
a/src/lib/cinema_kdms.cc
b/src/lib/cinema_kdms.cc
index cbfad4bb3706c4c824d6bd5fdd04c1a79684734b..c5057873417622c1cb24b8276cdcde695e0ad661 100644
(file)
--- a/
src/lib/cinema_kdms.cc
+++ b/
src/lib/cinema_kdms.cc
@@
-53,7
+53,7
@@
CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, KDMNameFormat name_
list<shared_ptr<string> > kdm_strings;
list<shared_ptr<string> > kdm_strings;
- name_values[
"cinema"
] = cinema->name;
+ name_values[
'c'
] = cinema->name;
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
shared_ptr<string> kdm (new string (i.kdm.as_xml ()));
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
shared_ptr<string> kdm (new string (i.kdm.as_xml ()));
@@
-64,7
+64,7
@@
CinemaKDMs::make_zip_file (boost::filesystem::path zip_file, KDMNameFormat name_
throw runtime_error ("could not create ZIP source");
}
throw runtime_error ("could not create ZIP source");
}
- name_values[
"screen"
] = i.screen->name;
+ name_values[
's'
] = i.screen->name;
string const name = name_format.get(name_values) + ".xml";
if (zip_add (zip, name.c_str(), source) == -1) {
throw runtime_error ("failed to add KDM to ZIP archive");
string const name = name_format.get(name_values) + ".xml";
if (zip_add (zip, name.c_str(), source) == -1) {
throw runtime_error ("failed to add KDM to ZIP archive");
@@
-124,11
+124,11
@@
CinemaKDMs::write_zip_files (
)
{
/* No specific screen */
)
{
/* No specific screen */
- name_values[
"screen"
] = "";
+ name_values[
's'
] = "";
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
boost::filesystem::path path = directory;
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
boost::filesystem::path path = directory;
- name_values[
"cinema"
] = i.cinema->name;
+ name_values[
'c'
] = i.cinema->name;
path /= name_format.get(name_values) + ".zip";
i.make_zip_file (path, name_format, name_values);
}
path /= name_format.get(name_values) + ".zip";
i.make_zip_file (path, name_format, name_values);
}
@@
-153,11
+153,11
@@
CinemaKDMs::email (
}
/* No specific screen */
}
/* No specific screen */
- name_values[
"screen"
] = "";
+ name_values[
's'
] = "";
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
- name_values[
"cinema"
] = i.cinema->name;
+ name_values[
'c'
] = i.cinema->name;
boost::filesystem::path zip_file = boost::filesystem::temp_directory_path ();
zip_file /= boost::filesystem::unique_path().string() + ".zip";
boost::filesystem::path zip_file = boost::filesystem::temp_directory_path ();
zip_file /= boost::filesystem::unique_path().string() + ".zip";
@@
-165,14
+165,14
@@
CinemaKDMs::email (
string subject = config->kdm_subject();
boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
string subject = config->kdm_subject();
boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
- boost::algorithm::replace_all (subject, "$START_TIME", name_values[
"from"
]);
- boost::algorithm::replace_all (subject, "$END_TIME", name_values[
"to"
]);
+ boost::algorithm::replace_all (subject, "$START_TIME", name_values[
'f'
]);
+ boost::algorithm::replace_all (subject, "$END_TIME", name_values[
't'
]);
boost::algorithm::replace_all (subject, "$CINEMA_NAME", i.cinema->name);
string body = config->kdm_email().c_str();
boost::algorithm::replace_all (body, "$CPL_NAME", cpl_name);
boost::algorithm::replace_all (subject, "$CINEMA_NAME", i.cinema->name);
string body = config->kdm_email().c_str();
boost::algorithm::replace_all (body, "$CPL_NAME", cpl_name);
- boost::algorithm::replace_all (body, "$START_TIME", name_values[
"from"
]);
- boost::algorithm::replace_all (body, "$END_TIME", name_values[
"to"
]);
+ boost::algorithm::replace_all (body, "$START_TIME", name_values[
'f'
]);
+ boost::algorithm::replace_all (body, "$END_TIME", name_values[
't'
]);
boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
locked_stringstream screens;
boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
locked_stringstream screens;
diff --git
a/src/lib/kdm_name_format.cc
b/src/lib/kdm_name_format.cc
index fe4a3fc62b77fb5d15c8fed58be1e4fa7edc395b..bf17acbf1f3f39115e18f7b75e035d661bce63f6 100644
(file)
--- a/
src/lib/kdm_name_format.cc
+++ b/
src/lib/kdm_name_format.cc
@@
-25,9
+25,14
@@
using std::string;
KDMNameFormat::KDMNameFormat (string specification)
: NameFormat (specification)
{
KDMNameFormat::KDMNameFormat (string specification)
: NameFormat (specification)
{
- add ("film_name", 'f', "film name");
- add ("cinema", 'c', "cinema");
- add ("screen", 's', "screen");
- add ("from", 'b', "from date/time");
- add ("to", 'e', "to date/time");
+ /* film name */
+ add ('f');
+ /* cinema */
+ add ('c');
+ /* screen */
+ add ('s');
+ /* from date/time */
+ add ('b');
+ /* to date/time */
+ add ('e');
}
}
diff --git
a/src/lib/screen_kdm.cc
b/src/lib/screen_kdm.cc
index 22081fc81d399e8987214028a9dda0ccdc8dcaf2..3290d2a685d1ba8d9883ab2e050f963718952348 100644
(file)
--- a/
src/lib/screen_kdm.cc
+++ b/
src/lib/screen_kdm.cc
@@
-39,8
+39,8
@@
ScreenKDM::write_files (list<ScreenKDM> screen_kdms, boost::filesystem::path dir
{
/* Write KDMs to the specified directory */
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
{
/* Write KDMs to the specified directory */
BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
- name_values[
"cinema"
] = i.screen->cinema->name;
- name_values[
"screen"
] = i.screen->name;
+ name_values[
'c'
] = i.screen->cinema->name;
+ name_values[
's'
] = i.screen->name;
boost::filesystem::path out = directory / (name_format.get(name_values) + ".xml");
i.kdm.as_xml (out);
}
boost::filesystem::path out = directory / (name_format.get(name_values) + ".xml");
i.kdm.as_xml (out);
}
diff --git
a/src/lib/send_kdm_email_job.cc
b/src/lib/send_kdm_email_job.cc
index 3bf1887f49df2bdf12bf9bade02a2026a03fa7f8..e4b20167e2fcd4176c16d09b82c5d84c7234020e 100644
(file)
--- a/
src/lib/send_kdm_email_job.cc
+++ b/
src/lib/send_kdm_email_job.cc
@@
-51,7
+51,7
@@
SendKDMEmailJob::SendKDMEmailJob (
string
SendKDMEmailJob::name () const
{
string
SendKDMEmailJob::name () const
{
- dcp::NameFormat::Map::const_iterator i = _name_values.find (
"film_name"
);
+ dcp::NameFormat::Map::const_iterator i = _name_values.find (
'f'
);
if (i == _name_values.end() || i->second.empty ()) {
return _("Email KDMs");
}
if (i == _name_values.end() || i->second.empty ()) {
return _("Email KDMs");
}
diff --git
a/src/lib/util.cc
b/src/lib/util.cc
index 09f32dfda5d4b541fe5c4874a041fc47aeb6f3bf..59974c24c07bd33803923ee1cdef27e3c7ee207d 100644
(file)
--- a/
src/lib/util.cc
+++ b/
src/lib/util.cc
@@
-620,8
+620,8
@@
string
video_asset_filename (shared_ptr<dcp::PictureAsset> asset)
{
dcp::NameFormat::Map values;
video_asset_filename (shared_ptr<dcp::PictureAsset> asset)
{
dcp::NameFormat::Map values;
- values[
"type"
] = "j2c";
- values[
"id"
] = asset->id();
+ values[
't'
] = "j2c";
+ values[
'i'
] = asset->id();
return Config::instance()->dcp_filename_format().get(values) + ".mxf";
}
return Config::instance()->dcp_filename_format().get(values) + ".mxf";
}
@@
-629,8
+629,8
@@
string
audio_asset_filename (shared_ptr<dcp::SoundAsset> asset)
{
dcp::NameFormat::Map values;
audio_asset_filename (shared_ptr<dcp::SoundAsset> asset)
{
dcp::NameFormat::Map values;
- values[
"type"
] = "pcm";
- values[
"id"
] = asset->id();
+ values[
't'
] = "pcm";
+ values[
'i'
] = asset->id();
return Config::instance()->dcp_filename_format().get(values) + ".mxf";
}
return Config::instance()->dcp_filename_format().get(values) + ".mxf";
}
diff --git
a/src/tools/dcpomatic_kdm.cc
b/src/tools/dcpomatic_kdm.cc
index 01f8ef0a3acb6e839b434314fded4fcb883ec961..362d8105f0c862d4d7ea824e52de7b773994a2df 100644
(file)
--- a/
src/tools/dcpomatic_kdm.cc
+++ b/
src/tools/dcpomatic_kdm.cc
@@
-298,9
+298,9
@@
private:
}
dcp::NameFormat::Map name_values;
}
dcp::NameFormat::Map name_values;
- name_values[
"film_name"
] = decrypted.content_title_text();
- name_values[
"from"
] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
- name_values[
"to"
] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
+ name_values[
'f'
] = decrypted.content_title_text();
+ name_values[
'b'
] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
+ name_values[
'e'
] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
if (_output->write_to()) {
ScreenKDM::write_files (screen_kdms, _output->directory(), _output->name_format(), name_values);
if (_output->write_to()) {
ScreenKDM::write_files (screen_kdms, _output->directory(), _output->name_format(), name_values);
diff --git
a/src/tools/dcpomatic_kdm_cli.cc
b/src/tools/dcpomatic_kdm_cli.cc
index 38808596ec25f01605fc0d48217e44823388fa6d..de89a9c7c2446f120c20f72ec5203a63e3a368e6 100644
(file)
--- a/
src/tools/dcpomatic_kdm_cli.cc
+++ b/
src/tools/dcpomatic_kdm_cli.cc
@@
-285,9
+285,9
@@
int main (int argc, char* argv[])
}
dcp::NameFormat::Map values;
}
dcp::NameFormat::Map values;
- values[
"film_name"
] = film->name();
- values[
"from"
] = dcp::LocalTime(valid_from.get()).date() + " " + dcp::LocalTime(valid_from.get()).time_of_day();
- values[
"to"
] = dcp::LocalTime(valid_to.get()).date() + " " + dcp::LocalTime(valid_to.get()).time_of_day();
+ values[
'f'
] = film->name();
+ values[
'b'
] = dcp::LocalTime(valid_from.get()).date() + " " + dcp::LocalTime(valid_from.get()).time_of_day();
+ values[
'e'
] = dcp::LocalTime(valid_to.get()).date() + " " + dcp::LocalTime(valid_to.get()).time_of_day();
try {
list<ScreenKDM> screen_kdms = film->make_kdms (
try {
list<ScreenKDM> screen_kdms = film->make_kdms (
diff --git
a/src/wx/config_dialog.cc
b/src/wx/config_dialog.cc
index c82956c608a2cf1ad86c85434ad58034c76a956b..a68f4576dc69f50a5955f64ed1e94bdf8c8383fd 100644
(file)
--- a/
src/wx/config_dialog.cc
+++ b/
src/wx/config_dialog.cc
@@
-1410,11
+1410,13
@@
private:
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
- _dcp_filename_format = new NameFormatEditor<dcp::FilenameFormat> (_panel, Config::instance()->dcp_filename_format());
- dcp::NameFormat::Map example;
- example["type"] = "j2c";
- example["id"] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64";
- _dcp_filename_format->set_example (example);
+ dcp::NameFormat::Map titles;
+ titles['t'] = "type (j2c/pcm/sub/cpl/pkl)";
+ titles['i'] = "unique ID";
+ dcp::NameFormat::Map examples;
+ examples['t'] = "j2c";
+ examples['i'] = "eb1c112c-ca3c-4ae6-9263-c6714ff05d64";
+ _dcp_filename_format = new NameFormatEditor<dcp::FilenameFormat> (_panel, Config::instance()->dcp_filename_format(), titles, examples);
table->Add (_dcp_filename_format->panel(), 1, wxEXPAND | wxALL);
#ifdef __WXOSX__
table->Add (_dcp_filename_format->panel(), 1, wxEXPAND | wxALL);
#ifdef __WXOSX__
diff --git
a/src/wx/kdm_dialog.cc
b/src/wx/kdm_dialog.cc
index cd018686ed4a9a6308c059b310ba2e4f7f4b3661..ef7912ee3c2adf2133672779aba63148d751209c 100644
(file)
--- a/
src/wx/kdm_dialog.cc
+++ b/
src/wx/kdm_dialog.cc
@@
-134,9
+134,9
@@
KDMDialog::make_clicked ()
);
dcp::NameFormat::Map name_values;
);
dcp::NameFormat::Map name_values;
- name_values[
"film_name"
] = film->name();
- name_values[
"from"
] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
- name_values[
"to"
] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
+ name_values[
'f'
] = film->name();
+ name_values[
'b'
] = dcp::LocalTime(_timing->from()).date() + " " + dcp::LocalTime(_timing->from()).time_of_day();
+ name_values[
'e'
] = dcp::LocalTime(_timing->until()).date() + " " + dcp::LocalTime(_timing->until()).time_of_day();
if (_output->write_to ()) {
ScreenKDM::write_files (
if (_output->write_to ()) {
ScreenKDM::write_files (
diff --git
a/src/wx/kdm_output_panel.cc
b/src/wx/kdm_output_panel.cc
index 1d9e56f4bac48cf0cea67f19478c10b8ea8f9bef..4efb9fb27ab02fff695108d9be13ab829b3a5a76 100644
(file)
--- a/
src/wx/kdm_output_panel.cc
+++ b/
src/wx/kdm_output_panel.cc
@@
-46,7
+46,7
@@
KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
_type->SetSelection (0);
{
_type->SetSelection (0);
{
- int flags = wxALIGN_TOP | wxTOP | wxLEFT;
+ int flags = wxALIGN_TOP | wxTOP | wxLEFT
| wxRIGHT
;
wxString t = _("Filename format");
#ifdef __WXOSX__
flags |= wxALIGN_RIGHT;
wxString t = _("Filename format");
#ifdef __WXOSX__
flags |= wxALIGN_RIGHT;
@@
-56,14
+56,19
@@
KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
}
- _filename_format = new NameFormatEditor<KDMNameFormat> (this, Config::instance()->kdm_filename_format());
+ dcp::NameFormat::Map titles;
+ titles['f'] = "film name";
+ titles['c'] = "cinema";
+ titles['s'] = "screen";
+ titles['b'] = "from date/time";
+ titles['e'] = "to date/time";
dcp::NameFormat::Map ex;
dcp::NameFormat::Map ex;
- ex[
"film_name"
] = "Bambi";
- ex[
"cinema"
] = "Lumière";
- ex[
"screen"
] = "Screen 1";
- ex[
"from"
] = "2012/03/15 12:30";
- ex[
"to"
] = "2012/03/22 02:30";
- _filename_format
->set_example (
ex);
+ ex[
'f'
] = "Bambi";
+ ex[
'c'
] = "Lumière";
+ ex[
's'
] = "Screen 1";
+ ex[
'b'
] = "2012/03/15 12:30";
+ ex[
'e'
] = "2012/03/22 02:30";
+ _filename_format
= new NameFormatEditor<KDMNameFormat> (this, Config::instance()->kdm_filename_format(), titles,
ex);
table->Add (_filename_format->panel(), 1, wxEXPAND);
_write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
table->Add (_filename_format->panel(), 1, wxEXPAND);
_write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
diff --git
a/src/wx/name_format_editor.h
b/src/wx/name_format_editor.h
index 1ca4c0b719864b0ae9adcb934f30fbed18130f8d..0f46821274a092c8b40468da581dc0b8000a0f6c 100644
(file)
--- a/
src/wx/name_format_editor.h
+++ b/
src/wx/name_format_editor.h
@@
-30,19
+30,20
@@
template <class T>
class NameFormatEditor
{
public:
class NameFormatEditor
{
public:
- NameFormatEditor (wxWindow* parent, T name)
+ NameFormatEditor (wxWindow* parent, T name
, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples
)
: _panel (new wxPanel (parent))
, _example (new wxStaticText (_panel, wxID_ANY, ""))
, _sizer (new wxBoxSizer (wxVERTICAL))
, _specification (new wxTextCtrl (_panel, wxID_ANY, ""))
, _name (name)
: _panel (new wxPanel (parent))
, _example (new wxStaticText (_panel, wxID_ANY, ""))
, _sizer (new wxBoxSizer (wxVERTICAL))
, _specification (new wxTextCtrl (_panel, wxID_ANY, ""))
, _name (name)
+ , _examples (examples)
{
_sizer->Add (_specification, 0, wxEXPAND, DCPOMATIC_SIZER_Y_GAP);
_sizer->Add (_example, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
_panel->SetSizer (_sizer);
{
_sizer->Add (_specification, 0, wxEXPAND, DCPOMATIC_SIZER_Y_GAP);
_sizer->Add (_example, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP);
_panel->SetSizer (_sizer);
- BOOST_FOREACH (
dcp::NameFormat::Component
c, name.components ()) {
- wxStaticText* t = new wxStaticText (_panel, wxID_ANY, std_to_wx (String::compose ("%%%1 %2", c
.placeholder, c.title
)));
+ BOOST_FOREACH (
char
c, name.components ()) {
+ wxStaticText* t = new wxStaticText (_panel, wxID_ANY, std_to_wx (String::compose ("%%%1 %2", c
, titles[c]
)));
_sizer->Add (t);
wxFont font = t->GetFont();
font.SetStyle (wxFONTSTYLE_ITALIC);
_sizer->Add (t);
wxFont font = t->GetFont();
font.SetStyle (wxFONTSTYLE_ITALIC);
@@
-57,16
+58,10
@@
public:
update_example ();
}
update_example ();
}
- wxPanel* panel () const
- {
+ wxPanel* panel () const {
return _panel;
}
return _panel;
}
- void set_example (dcp::NameFormat::Map v) {
- _example_values = v;
- update_example ();
- }
-
T get () const {
return _name;
}
T get () const {
return _name;
}
@@
-85,7
+80,7
@@
private:
{
_name.set_specification (wx_to_std (_specification->GetValue ()));
{
_name.set_specification (wx_to_std (_specification->GetValue ()));
- wxString example = wxString::Format (_("e.g. %s"), _name.get (_example
_value
s));
+ wxString example = wxString::Format (_("e.g. %s"), _name.get (_examples));
wxString wrapped;
for (size_t i = 0; i < example.Length(); ++i) {
if (i > 0 && (i % 30) == 0) {
wxString wrapped;
for (size_t i = 0; i < example.Length(); ++i) {
if (i > 0 && (i % 30) == 0) {
@@
-103,7
+98,7
@@
private:
wxTextCtrl* _specification;
T _name;
wxTextCtrl* _specification;
T _name;
- dcp::NameFormat::Map _example
_value
s;
+ dcp::NameFormat::Map _examples;
};
#endif
};
#endif