Release 1.0.0.4: album artists, credits, artist genres, maintenance task
This commit is contained in:
1 parent
84e3ea34c8
commit
0dbf427ce1
17 files changed
+332
-14
No files matched your search
@@ -91,6 +91,7 @@ public class YandexMusicSongProvider : IRemoteMetadataProvider<Audio, SongInfo>,
|
||||
|
||||
audio.Artists = artistNames;
|
||||
audio.AlbumArtists = albumArtistNames;
|
||||
AlbumArtistCache.Set(info.Path, albumArtistNames);
|
||||
audio.Album = config.UseYandexAlbumName
|
||||
? album?.Title ?? info.Album
|
||||
: string.IsNullOrWhiteSpace(info.Album) ? album?.Title : info.Album;
|
||||
@@ -101,15 +102,32 @@ public class YandexMusicSongProvider : IRemoteMetadataProvider<Audio, SongInfo>,
|
||||
}
|
||||
|
||||
audio.PremiereDate = Mapping.ParseReleaseDate(album?.ReleaseDate);
|
||||
audio.Genres = await Mapping.GenresAsync(_client, album?.Genre, null, cancellationToken)
|
||||
var primaryArtistForGenres = track.Artists.FirstOrDefault(a => a.Id > 0);
|
||||
var artistGenres = primaryArtistForGenres is null
|
||||
? Array.Empty<string>()
|
||||
: await _client.GetArtistGenresAsync(primaryArtistForGenres.Id, cancellationToken).ConfigureAwait(false);
|
||||
audio.Genres = await Mapping.GenresAsync(_client, album?.Genre, artistGenres, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var labels = Mapping.Labels(album);
|
||||
if (labels.Length == 0 && !string.IsNullOrWhiteSpace(track.Major?.Name))
|
||||
if (labels.Length == 0 && !string.IsNullOrWhiteSpace(track.Major?.Name) && track.Major.Id > 0)
|
||||
{
|
||||
labels = [track.Major!.Name!];
|
||||
}
|
||||
|
||||
if (config.EnableCredits)
|
||||
{
|
||||
var credits = await _client.GetTrackCreditsAsync(track.Id, cancellationToken).ConfigureAwait(false);
|
||||
Mapping.AddCredits(result, credits);
|
||||
if (labels.Length == 0)
|
||||
{
|
||||
labels = Mapping.CreditValues(credits, Mapping.IsLabelRole)
|
||||
.SelectMany(Mapping.SplitNames)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
if (labels.Length > 0)
|
||||
{
|
||||
audio.Studios = labels;
|
||||
|
||||
Reference in new issue
Block a user