|
|
@ -98,14 +98,17 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
.ToArray();
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
var musicbrainzAlbumArtistId = item.GetProviderId(MetadataProvider.MusicBrainzAlbumArtist);
|
|
|
|
var musicbrainzAlbumArtistId = item.GetProviderId(MetadataProvider.MusicBrainzAlbumArtist);
|
|
|
|
|
|
|
|
if (musicbrainzAlbumArtistIds.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
var firstMusicbrainzAlbumArtistId = musicbrainzAlbumArtistIds[0];
|
|
|
|
var firstMusicbrainzAlbumArtistId = musicbrainzAlbumArtistIds[0];
|
|
|
|
if (!string.IsNullOrEmpty(firstMusicbrainzAlbumArtistId) &&
|
|
|
|
if (!string.IsNullOrEmpty(firstMusicbrainzAlbumArtistId)
|
|
|
|
(string.IsNullOrEmpty(musicbrainzAlbumArtistId)
|
|
|
|
&& (string.IsNullOrEmpty(musicbrainzAlbumArtistId)
|
|
|
|
|| !musicbrainzAlbumArtistId.Equals(firstMusicbrainzAlbumArtistId, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|| !musicbrainzAlbumArtistId.Equals(firstMusicbrainzAlbumArtistId, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, firstMusicbrainzAlbumArtistId);
|
|
|
|
item.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, firstMusicbrainzAlbumArtistId);
|
|
|
|
updateType |= ItemUpdateType.MetadataEdit;
|
|
|
|
updateType |= ItemUpdateType.MetadataEdit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!item.AlbumArtists.SequenceEqual(albumArtists, StringComparer.OrdinalIgnoreCase))
|
|
|
|
if (!item.AlbumArtists.SequenceEqual(albumArtists, StringComparer.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -148,13 +151,17 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
.ToArray();
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
var musicbrainzAlbumId = item.GetProviderId(MetadataProvider.MusicBrainzAlbum);
|
|
|
|
var musicbrainzAlbumId = item.GetProviderId(MetadataProvider.MusicBrainzAlbum);
|
|
|
|
if (!String.IsNullOrEmpty(musicbrainzAlbumIds[0])
|
|
|
|
if (musicbrainzAlbumIds.Any())
|
|
|
|
&& (String.IsNullOrEmpty(musicbrainzAlbumId)
|
|
|
|
|
|
|
|
|| !musicbrainzAlbumId.Equals(musicbrainzAlbumIds[0], StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.SetProviderId(MetadataProvider.MusicBrainzAlbum, musicbrainzAlbumIds[0]!);
|
|
|
|
var firstMusicbrainzAlbumId = musicbrainzAlbumIds[0];
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(firstMusicbrainzAlbumId)
|
|
|
|
|
|
|
|
&& (string.IsNullOrEmpty(musicbrainzAlbumId)
|
|
|
|
|
|
|
|
|| !musicbrainzAlbumId.Equals(firstMusicbrainzAlbumId, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item.SetProviderId(MetadataProvider.MusicBrainzAlbum, firstMusicbrainzAlbumId);
|
|
|
|
updateType |= ItemUpdateType.MetadataEdit;
|
|
|
|
updateType |= ItemUpdateType.MetadataEdit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var musicbrainzReleaseGroupIds = songs
|
|
|
|
var musicbrainzReleaseGroupIds = songs
|
|
|
|
.Select(i => i.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup))
|
|
|
|
.Select(i => i.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup))
|
|
|
@ -164,13 +171,17 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
.ToArray();
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
var musicbrainzReleaseGroupId = item.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
|
|
|
|
var musicbrainzReleaseGroupId = item.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
|
|
|
|
if (!String.IsNullOrEmpty(musicbrainzReleaseGroupIds[0])
|
|
|
|
if (musicbrainzReleaseGroupIds.Any())
|
|
|
|
&& (String.IsNullOrEmpty(musicbrainzReleaseGroupId)
|
|
|
|
|
|
|
|
|| !musicbrainzReleaseGroupId.Equals(musicbrainzReleaseGroupIds[0], StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, musicbrainzReleaseGroupIds[0]!);
|
|
|
|
var firstMusicbrainzReleaseGroupId = musicbrainzReleaseGroupIds[0];
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(firstMusicbrainzReleaseGroupId)
|
|
|
|
|
|
|
|
&& (string.IsNullOrEmpty(musicbrainzReleaseGroupId)
|
|
|
|
|
|
|
|
|| !musicbrainzReleaseGroupId.Equals(firstMusicbrainzReleaseGroupId, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, firstMusicbrainzReleaseGroupId);
|
|
|
|
updateType |= ItemUpdateType.MetadataEdit;
|
|
|
|
updateType |= ItemUpdateType.MetadataEdit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return updateType;
|
|
|
|
return updateType;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -228,41 +239,29 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
|
|
|
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.GetProviderId(MetadataProvider.MusicBrainzAlbumArtist)))
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.GetProviderId(MetadataProvider.MusicBrainzAlbumArtist)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var targetAlbumArtistId = targetItem.GetProviderId(MetadataProvider.MusicBrainzAlbumArtist);
|
|
|
|
setProviderId(sourceItem, targetItem, MetadataProvider.MusicBrainzAlbumArtist);
|
|
|
|
var sourceAlbumArtistId = sourceItem.GetProviderId(MetadataProvider.MusicBrainzAlbumArtist);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(sourceAlbumArtistId)
|
|
|
|
|
|
|
|
&& (string.IsNullOrEmpty(targetAlbumArtistId)
|
|
|
|
|
|
|
|
|| !targetAlbumArtistId.Equals(sourceAlbumArtistId, StringComparison.Ordinal)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
targetItem.SetProviderId(MetadataProvider.MusicBrainzAlbumArtist, sourceAlbumArtistId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.GetProviderId(MetadataProvider.MusicBrainzAlbum)))
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.GetProviderId(MetadataProvider.MusicBrainzAlbum)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var targetAlbumId = targetItem.GetProviderId(MetadataProvider.MusicBrainzAlbum);
|
|
|
|
setProviderId(sourceItem, targetItem, MetadataProvider.MusicBrainzAlbum);
|
|
|
|
var sourceAlbumId = sourceItem.GetProviderId(MetadataProvider.MusicBrainzAlbum);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(sourceAlbumId)
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup)))
|
|
|
|
&& (string.IsNullOrEmpty(targetAlbumId)
|
|
|
|
|
|
|
|
|| !targetAlbumId.Equals(sourceAlbumId, StringComparison.Ordinal)))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
targetItem.SetProviderId(MetadataProvider.MusicBrainzAlbum, sourceAlbumId);
|
|
|
|
setProviderId(sourceItem, targetItem, MetadataProvider.MusicBrainzReleaseGroup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (replaceData || string.IsNullOrEmpty(targetItem.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup)))
|
|
|
|
private void setProviderId(MusicAlbum sourceItem, MusicAlbum targetItem, MetadataProvider provider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var targetReleaseGroupId = targetItem.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
|
|
|
|
var source = sourceItem.GetProviderId(provider);
|
|
|
|
var sourceReleaseGroupId = sourceItem.GetProviderId(MetadataProvider.MusicBrainzReleaseGroup);
|
|
|
|
var target = targetItem.GetProviderId(provider);
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(source)
|
|
|
|
if (!string.IsNullOrEmpty(sourceReleaseGroupId)
|
|
|
|
&& (string.IsNullOrEmpty(target)
|
|
|
|
&& (string.IsNullOrEmpty(targetReleaseGroupId)
|
|
|
|
|| !target.Equals(source, StringComparison.Ordinal)))
|
|
|
|
|| !targetReleaseGroupId.Equals(sourceItem)))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
targetItem.SetProviderId(MetadataProvider.MusicBrainzReleaseGroup, sourceReleaseGroupId);
|
|
|
|
targetItem.SetProviderId(provider, source);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|