From 289a4f39bb5f9da70192895326b3e98b1ac6330c Mon Sep 17 00:00:00 2001 From: Andrew Polden Date: Sun, 10 Oct 2021 13:39:11 +1100 Subject: [PATCH 1/3] Support YEAR vorbis comment Where the DATE comment is not available, fall back to using YEAR. --- tagutils/tagutils-misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tagutils/tagutils-misc.c b/tagutils/tagutils-misc.c index 0075bab..9711e18 100644 --- a/tagutils/tagutils-misc.c +++ b/tagutils/tagutils-misc.c @@ -209,6 +209,8 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length) // -- following tags are muliples // COMPOSER, ARRANGER, LYRICIST, AUTHOR, CONDUCTOR, PERFORMER, ENSEMBLE, PART // PARTNUMBER, GENRE, DATE, LOCATION, COMMENT + // -- In addition, some software (e.g. Windows Media Player) insists on using YEAR + // -- rather than DATE, so support this where DATE is not available for reasons of usefulness. if(!strncasecmp(strbuf, "ALBUM=", 6)) { if( *(strbuf+6) ) @@ -250,7 +252,8 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length) if( *(strbuf+6) ) psong->genre = strdup(strbuf + 6); } - else if(!strncasecmp(strbuf, "DATE=", 5)) + else if(!strncasecmp(strbuf, "DATE=", 5) || + (!strncasecmp(strbuf, "YEAR=", 5) && psong->year == 0)) { if(length >= (5 + 10) && isdigit(strbuf[5 + 0]) && isdigit(strbuf[5 + 1]) && ispunct(strbuf[5 + 2]) && From a8325705ef9dbc47a4d58e4dd9c06bf0b280f8b9 Mon Sep 17 00:00:00 2001 From: Andrew Polden Date: Sun, 10 Oct 2021 13:41:19 +1100 Subject: [PATCH 2/3] Support other vorbis comments Some extended and commonly used tag names may store metadata useful to minidlna, so read these where allowance is already made for their storage and use. --- tagutils/tagutils-misc.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tagutils/tagutils-misc.c b/tagutils/tagutils-misc.c index 9711e18..e335bd6 100644 --- a/tagutils/tagutils-misc.c +++ b/tagutils/tagutils-misc.c @@ -203,7 +203,12 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length) } strncpy(strbuf, comment, length); strbuf[length] = '\0'; - + + // Xiph.org lists recommended field names for interoperability between programs. + // Beyond these software may use other tag names, and because the files we are + // tasked with reading may come from a variety of sources we include other commonly + // used tags where we can. + // https://xiph.org/vorbis/doc/v-comment.html // ALBUM, ARTIST, PUBLISHER, COPYRIGHT, DISCNUMBER, ISRC, EAN/UPN, LABEL, LABELNO, // LICENSE, OPUS, SOURCEMEDIA, TITLE, TRACKNUMBER, VERSION, ENCODED-BY, ENCODING, // -- following tags are muliples @@ -234,6 +239,16 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length) { psong->contributor_sort[ROLE_BAND] = strdup(strbuf + 16); } + else if(!strncasecmp(strbuf, "COMPOSER=", 9)) + { + if( *(strbuf+9) ) + psong->contributor[ROLE_COMPOSER] = strdup(strbuf + 9); + } + else if(!strncasecmp(strbuf, "CONDUCTOR=", 10)) + { + if( *(strbuf+10) ) + psong->contributor[ROLE_CONDUCTOR] = strdup(strbuf + 10); + } else if(!strncasecmp(strbuf, "TITLE=", 6)) { if( *(strbuf+6) ) @@ -243,10 +258,18 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length) { psong->track = atoi(strbuf + 12); } + else if(!strncasecmp(strbuf, "TRACKTOTAL=", 11)) + { + psong->total_tracks = atoi(strbuf + 11); + } else if(!strncasecmp(strbuf, "DISCNUMBER=", 11)) { psong->disc = atoi(strbuf + 11); } + else if(!strncasecmp(strbuf, "DISCTOTAL=", 10)) + { + psong->total_discs = atoi(strbuf + 10); + } else if(!strncasecmp(strbuf, "GENRE=", 6)) { if( *(strbuf+6) ) From 6feb4b4c97f16c205449277943d60ff4542c9e44 Mon Sep 17 00:00:00 2001 From: Andrew Polden Date: Sun, 10 Oct 2021 13:41:47 +1100 Subject: [PATCH 3/3] Support for FLAC sample size --- tagutils/tagutils-flc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tagutils/tagutils-flc.c b/tagutils/tagutils-flc.c index 926673b..e3deae4 100644 --- a/tagutils/tagutils-flc.c +++ b/tagutils/tagutils-flc.c @@ -65,6 +65,7 @@ _get_flctags(char *filename, struct song_metadata *psong) psong->song_length = (sec * 1000) + ms; psong->bitrate = (((uint64_t)(psong->file_size) * 1000) / (psong->song_length / 8)); psong->samplerate = block->data.stream_info.sample_rate; + psong->samplesize = block->data.stream_info.bits_per_sample; psong->channels = block->data.stream_info.channels; break;