Merge pull request #12294 from Bond-009/nullproviderid2

Fix (another) ArgumentNullException while scanning music
This commit is contained in:
Bond-009 2024-07-17 14:52:39 +02:00 committed by GitHub
commit 78ed8f660c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -325,22 +325,26 @@ namespace MediaBrowser.Providers.MediaInfo
audio.NormalizationGain = (float)tags.ReplayGainTrackGain; audio.NormalizationGain = (float)tags.ReplayGainTrackGain;
} }
if (options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzArtist, out _)) if ((options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzArtist, out _))
&& !string.IsNullOrEmpty(tags.MusicBrainzArtistId))
{ {
audio.SetProviderId(MetadataProvider.MusicBrainzArtist, tags.MusicBrainzArtistId); audio.SetProviderId(MetadataProvider.MusicBrainzArtist, tags.MusicBrainzArtistId);
} }
if (options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzAlbumArtist, out _)) if ((options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzAlbumArtist, out _))
&& !string.IsNullOrEmpty(tags.MusicBrainzReleaseArtistId))
{ {
audio.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, tags.MusicBrainzReleaseArtistId); audio.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, tags.MusicBrainzReleaseArtistId);
} }
if (options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzAlbum, out _)) if ((options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzAlbum, out _))
&& !string.IsNullOrEmpty(tags.MusicBrainzReleaseId))
{ {
audio.SetProviderId(MetadataProvider.MusicBrainzAlbum, tags.MusicBrainzReleaseId); audio.SetProviderId(MetadataProvider.MusicBrainzAlbum, tags.MusicBrainzReleaseId);
} }
if (options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzReleaseGroup, out _)) if ((options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzReleaseGroup, out _))
&& !string.IsNullOrEmpty(tags.MusicBrainzReleaseGroupId))
{ {
audio.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, tags.MusicBrainzReleaseGroupId); audio.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, tags.MusicBrainzReleaseGroupId);
} }