13
0

Change to C++11-style std::map initialization in ExportHandler::finish_timespan()

This commit is contained in:
Alejandro Domínguez 2024-08-31 02:28:34 +02:00 committed by Robin Gareus
parent b13f04c61e
commit 2263b0280b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -451,17 +451,8 @@ ExportHandler::finish_timespan ()
if (!fmt->command().empty()) { if (!fmt->command().empty()) {
SessionMetadata const & metadata (*SessionMetadata::Metadata()); SessionMetadata const & metadata (*SessionMetadata::Metadata());
#if 0 // would be nicer with C++11 initialiser...
std::map<char, std::string> subs {
{ 'f', filename },
{ 'd', Glib::path_get_dirname(filename) + G_DIR_SEPARATOR },
{ 'b', PBD::basename_nosuffix(filename) },
...
};
#endif
export_status->active_job = ExportStatus::Command; export_status->active_job = ExportStatus::Command;
PBD::ScopedConnection command_connection; PBD::ScopedConnection command_connection;
std::map<char, std::string> subs;
std::stringstream track_number; std::stringstream track_number;
track_number << metadata.track_number (); track_number << metadata.track_number ();
@ -470,30 +461,32 @@ ExportHandler::finish_timespan ()
std::stringstream year; std::stringstream year;
year << metadata.year (); year << metadata.year ();
subs.insert (std::pair<char, std::string> ('a', metadata.artist ())); std::map<char, std::string> subs {
subs.insert (std::pair<char, std::string> ('b', PBD::basename_nosuffix (filename))); {'a', metadata.artist ()},
subs.insert (std::pair<char, std::string> ('c', metadata.copyright ())); {'b', PBD::basename_nosuffix (filename)},
subs.insert (std::pair<char, std::string> ('d', Glib::path_get_dirname (filename) + G_DIR_SEPARATOR)); {'c', metadata.copyright ()},
subs.insert (std::pair<char, std::string> ('f', filename)); {'d', Glib::path_get_dirname (filename) + G_DIR_SEPARATOR},
subs.insert (std::pair<char, std::string> ('l', metadata.lyricist ())); {'f', filename},
subs.insert (std::pair<char, std::string> ('n', session.name ())); {'l', metadata.lyricist ()},
subs.insert (std::pair<char, std::string> ('s', session.path ())); {'n', session.name ()},
subs.insert (std::pair<char, std::string> ('o', metadata.conductor ())); {'s', session.path ()},
subs.insert (std::pair<char, std::string> ('t', metadata.title ())); {'o', metadata.conductor ()},
subs.insert (std::pair<char, std::string> ('z', metadata.organization ())); {'t', metadata.title ()},
subs.insert (std::pair<char, std::string> ('A', metadata.album ())); {'z', metadata.organization ()},
subs.insert (std::pair<char, std::string> ('C', metadata.comment ())); {'A', metadata.album ()},
subs.insert (std::pair<char, std::string> ('E', metadata.engineer ())); {'C', metadata.comment ()},
subs.insert (std::pair<char, std::string> ('G', metadata.genre ())); {'E', metadata.engineer ()},
subs.insert (std::pair<char, std::string> ('L', total_tracks.str ())); {'G', metadata.genre ()},
subs.insert (std::pair<char, std::string> ('M', metadata.mixer ())); {'L', total_tracks.str ()},
subs.insert (std::pair<char, std::string> ('N', current_timespan->name())); // =?= config_map.begin()->first->name () {'M', metadata.mixer ()},
subs.insert (std::pair<char, std::string> ('O', metadata.composer ())); {'N', current_timespan->name()}, // =?= config_map.begin()->first->name ()
subs.insert (std::pair<char, std::string> ('P', metadata.producer ())); {'O', metadata.composer ()},
subs.insert (std::pair<char, std::string> ('S', metadata.disc_subtitle ())); {'P', metadata.producer ()},
subs.insert (std::pair<char, std::string> ('T', track_number.str ())); {'S', metadata.disc_subtitle ()},
subs.insert (std::pair<char, std::string> ('Y', year.str ())); {'T', track_number.str ()},
subs.insert (std::pair<char, std::string> ('Z', metadata.country ())); {'Y', year.str ()},
{'Z', metadata.country ()}
};
ARDOUR::SystemExec *se = new ARDOUR::SystemExec(fmt->command(), subs, true); ARDOUR::SystemExec *se = new ARDOUR::SystemExec(fmt->command(), subs, true);
info << "Post-export command line : {" << se->to_s () << "}" << endmsg; info << "Post-export command line : {" << se->to_s () << "}" << endmsg;