diff --git a/NEWS b/NEWS index 7cc080e3..147ec074 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ ncmpc 0.50 - not yet released * remove option "text-editor-ask" * lyrics/musixmatch: add new lyrics extension * lyrics/google: fix partial loading of lyrics +* support MPD 0.22 tag "label" (requires libmpdclient 2.17) ncmpc 0.49 - (2023-08-04) * fix UI freeze if lyrics plugin is stuck diff --git a/src/Instance.cxx b/src/Instance.cxx index 1487566d..10b7be65 100644 --- a/src/Instance.cxx +++ b/src/Instance.cxx @@ -27,6 +27,9 @@ static constexpr TagMask global_tag_whitelist{ MPD_TAG_TRACK, MPD_TAG_DATE, MPD_TAG_GENRE, +#if LIBMPDCLIENT_CHECK_VERSION(2,17,0) + MPD_TAG_LABEL, +#endif MPD_TAG_COMMENT, }; diff --git a/src/SearchPage.cxx b/src/SearchPage.cxx index d7cd0e5f..d8848b5e 100644 --- a/src/SearchPage.cxx +++ b/src/SearchPage.cxx @@ -44,6 +44,7 @@ static constexpr struct { { MPD_TAG_DATE, "date", N_("date") }, { MPD_TAG_COMPOSER, "composer", N_("composer") }, { MPD_TAG_PERFORMER, "performer", N_("performer") }, + { MPD_TAG_LABEL, "label", N_("label") }, { MPD_TAG_COMMENT, "comment", N_("comment") }, { MPD_TAG_COUNT, nullptr, nullptr } }; @@ -92,7 +93,8 @@ static const char *const help_text[] = { " Example: modified:14d (units: s, M, h, d, m, y)", "", " Available tags: artist, album, title, track,", - " name, genre, date composer, performer, comment, file", + " name, genre, date composer, performer, label,", + " comment, file", "", }; diff --git a/src/SongPage.cxx b/src/SongPage.cxx index e47323b0..41af5461 100644 --- a/src/SongPage.cxx +++ b/src/SongPage.cxx @@ -65,6 +65,9 @@ static constexpr struct tag_label tag_labels[] = { { MPD_TAG_TRACK, N_("Track") }, { MPD_TAG_DATE, N_("Date") }, { MPD_TAG_GENRE, N_("Genre") }, +#if LIBMPDCLIENT_CHECK_VERSION(2,17,0) + { MPD_TAG_LABEL, N_("Label") }, +#endif { MPD_TAG_COMMENT, N_("Comment") }, { LABEL_PATH, N_("Path") }, { LABEL_BITRATE, N_("Bitrate") }, @@ -338,6 +341,7 @@ SongPage::AddSong(const struct mpd_song *song) noexcept AppendTag(song, MPD_TAG_TRACK); AppendTag(song, MPD_TAG_DATE); AppendTag(song, MPD_TAG_GENRE); + AppendTag(song, MPD_TAG_LABEL); AppendTag(song, MPD_TAG_COMMENT); AppendLine(get_tag_label(LABEL_PATH), mpd_song_get_uri(song), diff --git a/src/strfsong.cxx b/src/strfsong.cxx index b0a58bf3..25903a34 100644 --- a/src/strfsong.cxx +++ b/src/strfsong.cxx @@ -184,6 +184,8 @@ _strfsong(char *const s0, char *const end, tag = MPD_TAG_WORK; else if (name == "grouping"sv) tag = MPD_TAG_GROUPING; + else if (strncmp("%label%", p, n) == 0) + tag = MPD_TAG_LABEL; #endif else if (name == "title"sv) tag = MPD_TAG_TITLE;