Fix the probing of m4a metadata

The composer is not set in some of my m4a files. For some reason
TagLibSharp returns the composer as an empty string in this case. This
causes an exception in PeopleHelper.AddPerson, and thus probing fails.

IMHO we can simply ignore empty values.

Fixes: #10061
pull/10062/head
Jan Müller 2 years ago
parent d3c7af0d5c
commit 66ff724acf

@ -222,6 +222,8 @@ namespace MediaBrowser.Providers.MediaInfo
var people = new List<PersonInfo>(); var people = new List<PersonInfo>();
var albumArtists = tags.AlbumArtists; var albumArtists = tags.AlbumArtists;
foreach (var albumArtist in albumArtists) foreach (var albumArtist in albumArtists)
{
if (!string.IsNullOrEmpty(albumArtist))
{ {
PeopleHelper.AddPerson(people, new PersonInfo PeopleHelper.AddPerson(people, new PersonInfo
{ {
@ -229,9 +231,12 @@ namespace MediaBrowser.Providers.MediaInfo
Type = PersonKind.AlbumArtist Type = PersonKind.AlbumArtist
}); });
} }
}
var performers = tags.Performers; var performers = tags.Performers;
foreach (var performer in performers) foreach (var performer in performers)
{
if (!string.IsNullOrEmpty(performer))
{ {
PeopleHelper.AddPerson(people, new PersonInfo PeopleHelper.AddPerson(people, new PersonInfo
{ {
@ -239,8 +244,11 @@ namespace MediaBrowser.Providers.MediaInfo
Type = PersonKind.Artist Type = PersonKind.Artist
}); });
} }
}
foreach (var composer in tags.Composers) foreach (var composer in tags.Composers)
{
if (!string.IsNullOrEmpty(composer))
{ {
PeopleHelper.AddPerson(people, new PersonInfo PeopleHelper.AddPerson(people, new PersonInfo
{ {
@ -248,6 +256,7 @@ namespace MediaBrowser.Providers.MediaInfo
Type = PersonKind.Composer Type = PersonKind.Composer
}); });
} }
}
_libraryManager.UpdatePeople(audio, people); _libraryManager.UpdatePeople(audio, people);
audio.Artists = performers; audio.Artists = performers;

Loading…
Cancel
Save