From b2fd0ede8ed6042cdb1b18401485e50f6598ae54 Mon Sep 17 00:00:00 2001 From: "kbuffington@gmail.com" Date: Sat, 16 May 2020 22:50:09 -0500 Subject: [PATCH] Add options to disable writing musicbrainz discids, trackids, and albumid --- src/foo_musicbrainz.h | 4 ++-- src/foo_musicbrainz.rc | 28 +++++++++++++++++----------- src/helpers.cpp | 14 ++++++++++---- src/preferences.cpp | 27 +++++++++++++++++++++++++-- src/preferences.h | 3 +++ src/resource.h | 21 +++++++++++++-------- 6 files changed, 70 insertions(+), 27 deletions(-) diff --git a/src/foo_musicbrainz.h b/src/foo_musicbrainz.h index 0560469..0250214 100644 --- a/src/foo_musicbrainz.h +++ b/src/foo_musicbrainz.h @@ -4,6 +4,6 @@ namespace mb { static constexpr const char* component_title = "MusicBrainz Tagger"; static constexpr const char* component_dll_name = "foo_musicbrainz.dll"; - static constexpr const char* component_version = "0.4.5b4"; - static constexpr const char* component_info = "Copyright (C) 2009-2012 Dremora\nCopyright (C) 2015-2020 marc2003\nCopyright (C) 2020 MordredKLB\n\nBuild: " __TIME__ ", " __DATE__; + static constexpr const char* component_version = "0.4.5"; + static constexpr const char* component_info = "Copyright (C) 2009-2012 Dremora\nCopyright (C) 2015-2020 marc2003\nCopyright (C) 2020 Mordred\n\nBuild: " __TIME__ ", " __DATE__; } diff --git a/src/foo_musicbrainz.rc b/src/foo_musicbrainz.rc index 8f6281c..b6f80d4 100644 --- a/src/foo_musicbrainz.rc +++ b/src/foo_musicbrainz.rc @@ -57,17 +57,23 @@ BEGIN EDITTEXT IDC_EDIT_SERVER, 130, 5, 133, 14, ES_AUTOHSCROLL | WS_DISABLED AUTOCHECKBOX "Use year instead of full date (applies to DATE only, not ORIGINAL RELEASE DATE)", IDC_CHECK_SHORT_DATE, 7, 22, 290, 10 AUTOCHECKBOX "Convert Unicode punctuation characters to ASCII", IDC_CHECK_ASCII_PUNCTUATION, 7, 37, 200, 10 - AUTOCHECKBOX "Write MusicBrainz IDs", IDC_CHECK_WRITE_IDS, 7, 52, 200, 10 - AUTOCHECKBOX "Write Album Type, use field:", IDC_CHECK_WRITE_ALBUMTYPE, 7, 67, 120, 10 - EDITTEXT IDC_EDIT_ALBUMTYPE, 130, 65, 133, 14, ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED - AUTOCHECKBOX "Write Album Status, use field:", IDC_CHECK_WRITE_ALBUMSTATUS, 7, 83, 120, 10 - EDITTEXT IDC_EDIT_ALBUMSTATUS, 130, 81, 133, 14, ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED - AUTOCHECKBOX "Write LABEL, CATALOGNUMBER and BARCODE", IDC_CHECK_WRITE_LABEL_INFO, 7, 99, 200, 10 - AUTOCHECKBOX "Write RELEASECOUNTRY", IDC_CHECK_WRITE_COUNTRY, 7, 115, 200, 10 - AUTOCHECKBOX "Write MEDIA", IDC_CHECK_WRITE_MEDIA, 7, 131, 200, 10 - AUTOCHECKBOX "Write ASIN", IDC_CHECK_WRITE_ASIN, 7, 147, 200, 10 - AUTOCHECKBOX "Write ISRC", IDC_CHECK_WRITE_ISRC, 7, 163, 200, 10 - AUTOCHECKBOX "Always write ALBUM ARTIST", IDC_CHECK_WRITE_ALBUMARTIST, 7, 179, 200, 10 + GROUPBOX "", IDC_GROUPBOX_MBIDS, 3, 54, 260, 58 + AUTOCHECKBOX "Write MusicBrainz IDs", IDC_CHECK_WRITE_IDS, 7, 52, 100, 10 + AUTOCHECKBOX "Write Album ID", IDC_CHECK_WRITE_ALBUMID, 15, 67, 200, 10, WS_DISABLED + AUTOCHECKBOX "Write Disc IDs", IDC_CHECK_WRITE_DISCIDS, 15, 82, 200, 10, WS_DISABLED + AUTOCHECKBOX "Write Track IDs", IDC_CHECK_WRITE_TRACKIDS, 15, 97, 200, 10, WS_DISABLED + AUTOCHECKBOX "Write Album Type, use field:", IDC_CHECK_WRITE_ALBUMTYPE, 7, 118, 120, 10 + EDITTEXT IDC_EDIT_ALBUMTYPE, 130, 116, 133, 14, ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED + AUTOCHECKBOX "Write Album Status, use field:", IDC_CHECK_WRITE_ALBUMSTATUS, 7, 134, 120, 10 + EDITTEXT IDC_EDIT_ALBUMSTATUS, 130, 132, 133, 14, ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED + AUTOCHECKBOX "Write LABEL, CATALOGNUMBER and BARCODE", IDC_CHECK_WRITE_LABEL_INFO, 7, 150, 200, 10 + AUTOCHECKBOX "Write RELEASECOUNTRY", IDC_CHECK_WRITE_COUNTRY, 7, 165, 200, 10 + AUTOCHECKBOX "Write MEDIA", IDC_CHECK_WRITE_MEDIA, 7, 180, 200, 10 + AUTOCHECKBOX "Write ASIN", IDC_CHECK_WRITE_ASIN, 7, 195, 200, 10 + AUTOCHECKBOX "Write ISRC", IDC_CHECK_WRITE_ISRC, 7, 210, 200, 10 + AUTOCHECKBOX "Always write ALBUM ARTIST", IDC_CHECK_WRITE_ALBUMARTIST, 7, 225, 200, 10 + + END IDD_SEARCH DIALOGEX 0, 0, 185, 65 diff --git a/src/helpers.cpp b/src/helpers.cpp index 2fb9532..fda0d38 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -305,11 +305,17 @@ namespace mb if (prefs::check::write_ids.get_value()) { - if (release.discid.get_length()) info[i].meta_set("MUSICBRAINZ_DISCID", release.discid); - info[i].meta_set("MUSICBRAINZ_ALBUMID", release.albumid); info[i].meta_set("MUSICBRAINZ_RELEASEGROUPID", release.releasegroupid); - info[i].meta_set("MUSICBRAINZ_RELEASETRACKID", track.releasetrackid); - info[i].meta_set("MUSICBRAINZ_TRACKID", track.trackid); + if (prefs::check::write_discids.get_value() && release.discid.get_length()) { + info[i].meta_set("MUSICBRAINZ_DISCID", release.discid); + } + if (prefs::check::write_albumid.get_value()) { + info[i].meta_set("MUSICBRAINZ_ALBUMID", release.albumid); + } + if (prefs::check::write_trackids.get_value()) { + info[i].meta_set("MUSICBRAINZ_RELEASETRACKID", track.releasetrackid); + info[i].meta_set("MUSICBRAINZ_TRACKID", track.trackid); + } for (size_t j = 0; j < track.artistid.get_count(); ++j) { diff --git a/src/preferences.cpp b/src/preferences.cpp index e458e44..c15de62 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -8,10 +8,13 @@ namespace prefs static constexpr GUID check_short_date = { 0x18734618, 0x7920, 0x4d24,{ 0x84, 0xa1, 0xb9, 0xd6, 0x6e, 0xd8, 0x25, 0xbc } }; static constexpr GUID check_ascii_punctuation = { 0xd08b1b7c, 0x38fd, 0x4689,{ 0x9e, 0x91, 0x8c, 0xdc, 0xbe, 0xc4, 0x26, 0x98 } }; static constexpr GUID check_write_ids = { 0x8c8b61e0, 0x8eea, 0x4c34,{ 0x9a, 0x51, 0x4d, 0xa9, 0x9c, 0xec, 0xcb, 0xbc } }; + static constexpr GUID check_write_albumid = { 0xdbdbe746, 0x71bf, 0x4e44, { 0x8b, 0x74, 0xb4, 0xf8, 0xb3, 0x5a, 0x5e, 0xe9 } }; + static constexpr GUID check_write_discids = { 0x631b7da4, 0xab6b, 0x4be3, { 0xad, 0x9, 0x47, 0x7c, 0x8e, 0x3, 0xd6, 0x57 } }; + static constexpr GUID check_write_trackids = { 0xc406c2a7, 0x5a72, 0x4bbf, { 0x8d, 0xb9, 0x59, 0x88, 0x1e, 0x41, 0xe4, 0xff } }; static constexpr GUID check_write_albumtype = { 0xd8fdb1d8, 0xde2, 0x4f1f,{ 0x85, 0x5a, 0xc0, 0x5, 0x98, 0x60, 0x9b, 0xe9 } }; static constexpr GUID check_write_albumstatus = { 0x57a8dddd, 0xdf24, 0x4fd3,{ 0xac, 0x95, 0x6f, 0x8, 0x3, 0x26, 0x41, 0x7c } }; - static constexpr GUID check_write_label_info = { 0x9b3c94e3, 0x278, 0x4eb0,{ 0xa2, 0xed, 0x5, 0xad, 0xf8, 0xce, 0xa3, 0x9d } }; - static constexpr GUID check_write_country = { 0xa983fbd6, 0x7471, 0x41d7,{ 0xa7, 0x62, 0x27, 0xf9, 0x94, 0xe9, 0x23, 0x1f } }; + static constexpr GUID check_write_label_info = { 0x9b3c94e3, 0x278, 0x4eb0, { 0xa2, 0xed, 0x5, 0xad, 0xf8, 0xce, 0xa3, 0x9d } }; + static constexpr GUID check_write_country = { 0xa983fbd6, 0x7471, 0x41d7, { 0xa7, 0x62, 0x27, 0xf9, 0x94, 0xe9, 0x23, 0x1f } }; static constexpr GUID check_write_media = { 0x8e0f77e2, 0x50e8, 0x4e66,{ 0x88, 0xe3, 0xab, 0xed, 0x3b, 0x76, 0x84, 0x5a } }; static constexpr GUID check_write_asin = { 0x6677d957, 0xaa52, 0x4fef, { 0x95, 0x81, 0xb3, 0xe3, 0x20, 0x16, 0xaf, 0x4d } }; static constexpr GUID check_write_isrc = { 0x8b129571, 0x1bf2, 0x41bd, { 0x86, 0xf1, 0xcd, 0xec, 0x6, 0xb9, 0xf3, 0xff } }; @@ -28,6 +31,9 @@ namespace prefs static constexpr bool check_short_date = false; static constexpr bool check_ascii_punctuation = false; static constexpr bool check_write_ids = true; + static constexpr bool check_write_albumid = true; + static constexpr bool check_write_discids = true; + static constexpr bool check_write_trackids = true; static constexpr bool check_write_albumtype = true; static constexpr bool check_write_albumstatus = true; static constexpr bool check_write_label_info = true; @@ -48,6 +54,9 @@ namespace prefs cfg_bool short_date(guids::check_short_date, defaults::check_short_date); cfg_bool ascii_punctuation(guids::check_ascii_punctuation, defaults::check_ascii_punctuation); cfg_bool write_ids(guids::check_write_ids, defaults::check_write_ids); + cfg_bool write_albumid(guids::check_write_albumid, defaults::check_write_albumid); + cfg_bool write_discids(guids::check_write_discids, defaults::check_write_discids); + cfg_bool write_trackids(guids::check_write_trackids, defaults::check_write_trackids); cfg_bool write_albumtype(guids::check_write_albumtype, defaults::check_write_albumtype); cfg_bool write_albumstatus(guids::check_write_albumstatus, defaults::check_write_albumstatus); cfg_bool write_label_info(guids::check_write_label_info, defaults::check_write_label_info); @@ -94,6 +103,9 @@ namespace mb m_check_map[IDC_CHECK_SHORT_DATE] = { &check::short_date, defaults::check_short_date }; m_check_map[IDC_CHECK_ASCII_PUNCTUATION] = { &check::ascii_punctuation, defaults::check_ascii_punctuation }; m_check_map[IDC_CHECK_WRITE_IDS] = { &check::write_ids, defaults::check_write_ids }; + m_check_map[IDC_CHECK_WRITE_ALBUMID] = { &check::write_albumid, defaults::check_write_albumid, IDC_CHECK_WRITE_IDS }; + m_check_map[IDC_CHECK_WRITE_DISCIDS] = { &check::write_discids, defaults::check_write_discids, IDC_CHECK_WRITE_IDS }; + m_check_map[IDC_CHECK_WRITE_TRACKIDS] = { &check::write_trackids, defaults::check_write_trackids, IDC_CHECK_WRITE_IDS }; m_check_map[IDC_CHECK_WRITE_ALBUMTYPE] = { &check::write_albumtype, defaults::check_write_albumtype }; m_check_map[IDC_CHECK_WRITE_ALBUMSTATUS] = { &check::write_albumstatus, defaults::check_write_albumstatus }; m_check_map[IDC_CHECK_WRITE_LABEL_INFO] = { &check::write_label_info, defaults::check_write_label_info }; @@ -106,6 +118,9 @@ namespace mb for (auto& [key, value] : m_check_map) { value.check = GetDlgItem(key); + if (value.id) { + value.check.EnableWindow(m_check_map.at(value.id).setting->get_value()); + } value.check.SetCheck(value.setting->get_value()); } @@ -162,6 +177,13 @@ namespace mb void on_change() { + for (auto& [key, value] : m_check_map) + { + if (value.id) { + value.check.EnableWindow(m_check_map.at(value.id).check.IsChecked()); + } + } + for (auto& [key, value] : m_str_map) { value.edit.EnableWindow(m_check_map.at(value.id).check.IsChecked()); @@ -196,6 +218,7 @@ namespace mb { cfg_bool* setting; bool def; + int id; CCheckBox check; }; diff --git a/src/preferences.h b/src/preferences.h index e38889e..0c11c53 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -8,6 +8,9 @@ namespace prefs extern cfg_bool short_date; extern cfg_bool ascii_punctuation; extern cfg_bool write_ids; + extern cfg_bool write_albumid; + extern cfg_bool write_discids; + extern cfg_bool write_trackids; extern cfg_bool write_albumtype; extern cfg_bool write_albumstatus; extern cfg_bool write_label_info; diff --git a/src/resource.h b/src/resource.h index 8b6b46b..e125d0f 100644 --- a/src/resource.h +++ b/src/resource.h @@ -51,15 +51,20 @@ #define IDC_CHECK_SHORT_DATE 1102 #define IDC_CHECK_ASCII_PUNCTUATION 1103 #define IDC_CHECK_WRITE_IDS 1104 -#define IDC_CHECK_WRITE_ALBUMTYPE 1105 -#define IDC_CHECK_WRITE_ALBUMSTATUS 1106 -#define IDC_CHECK_WRITE_LABEL_INFO 1107 -#define IDC_CHECK_WRITE_COUNTRY 1108 -#define IDC_CHECK_WRITE_MEDIA 1109 -#define IDC_CHECK_WRITE_ASIN 1110 -#define IDC_CHECK_WRITE_ISRC 1111 -#define IDC_CHECK_WRITE_ALBUMARTIST 1112 +#define IDC_CHECK_WRITE_ALBUMID 1105 +#define IDC_CHECK_WRITE_DISCIDS 1106 +#define IDC_CHECK_WRITE_TRACKIDS 1107 +#define IDC_CHECK_WRITE_ALBUMTYPE 1108 +#define IDC_CHECK_WRITE_ALBUMSTATUS 1109 +#define IDC_CHECK_WRITE_LABEL_INFO 1110 +#define IDC_CHECK_WRITE_COUNTRY 1111 +#define IDC_CHECK_WRITE_MEDIA 1112 +#define IDC_CHECK_WRITE_ASIN 1113 +#define IDC_CHECK_WRITE_ISRC 1114 +#define IDC_CHECK_WRITE_ALBUMARTIST 1115 #define IDC_EDIT_SERVER 1120 #define IDC_EDIT_ALBUMTYPE 1121 #define IDC_EDIT_ALBUMSTATUS 1122 + +#define IDC_GROUPBOX_MBIDS 1130