Merge /u/andrensairr/minidlna/ branch master into master

https://sourceforge.net/p/minidlna/git/merge-requests/41/
This commit is contained in:
b'Justin Maggard 2022-02-11 16:57:24 +00:00
commit d54f5f6bd9
2 changed files with 29 additions and 2 deletions

View File

@ -65,6 +65,7 @@ _get_flctags(char *filename, struct song_metadata *psong)
psong->song_length = (sec * 1000) + ms; psong->song_length = (sec * 1000) + ms;
psong->bitrate = (((uint64_t)(psong->file_size) * 1000) / (psong->song_length / 8)); psong->bitrate = (((uint64_t)(psong->file_size) * 1000) / (psong->song_length / 8));
psong->samplerate = block->data.stream_info.sample_rate; psong->samplerate = block->data.stream_info.sample_rate;
psong->samplesize = block->data.stream_info.bits_per_sample;
psong->channels = block->data.stream_info.channels; psong->channels = block->data.stream_info.channels;
break; break;

View File

@ -203,12 +203,19 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length)
} }
strncpy(strbuf, comment, length); strncpy(strbuf, comment, length);
strbuf[length] = '\0'; 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, // ALBUM, ARTIST, PUBLISHER, COPYRIGHT, DISCNUMBER, ISRC, EAN/UPN, LABEL, LABELNO,
// LICENSE, OPUS, SOURCEMEDIA, TITLE, TRACKNUMBER, VERSION, ENCODED-BY, ENCODING, // LICENSE, OPUS, SOURCEMEDIA, TITLE, TRACKNUMBER, VERSION, ENCODED-BY, ENCODING,
// -- following tags are muliples // -- following tags are muliples
// COMPOSER, ARRANGER, LYRICIST, AUTHOR, CONDUCTOR, PERFORMER, ENSEMBLE, PART // COMPOSER, ARRANGER, LYRICIST, AUTHOR, CONDUCTOR, PERFORMER, ENSEMBLE, PART
// PARTNUMBER, GENRE, DATE, LOCATION, COMMENT // 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(!strncasecmp(strbuf, "ALBUM=", 6))
{ {
if( *(strbuf+6) ) if( *(strbuf+6) )
@ -232,6 +239,16 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length)
{ {
psong->contributor_sort[ROLE_BAND] = strdup(strbuf + 16); 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)) else if(!strncasecmp(strbuf, "TITLE=", 6))
{ {
if( *(strbuf+6) ) if( *(strbuf+6) )
@ -241,16 +258,25 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length)
{ {
psong->track = atoi(strbuf + 12); psong->track = atoi(strbuf + 12);
} }
else if(!strncasecmp(strbuf, "TRACKTOTAL=", 11))
{
psong->total_tracks = atoi(strbuf + 11);
}
else if(!strncasecmp(strbuf, "DISCNUMBER=", 11)) else if(!strncasecmp(strbuf, "DISCNUMBER=", 11))
{ {
psong->disc = atoi(strbuf + 11); psong->disc = atoi(strbuf + 11);
} }
else if(!strncasecmp(strbuf, "DISCTOTAL=", 10))
{
psong->total_discs = atoi(strbuf + 10);
}
else if(!strncasecmp(strbuf, "GENRE=", 6)) else if(!strncasecmp(strbuf, "GENRE=", 6))
{ {
if( *(strbuf+6) ) if( *(strbuf+6) )
psong->genre = strdup(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) && if(length >= (5 + 10) &&
isdigit(strbuf[5 + 0]) && isdigit(strbuf[5 + 1]) && ispunct(strbuf[5 + 2]) && isdigit(strbuf[5 + 0]) && isdigit(strbuf[5 + 1]) && ispunct(strbuf[5 + 2]) &&