Release 1.0.0.10: tag-based matching and metadata normalization
This commit is contained in:
1 parent
106e8f09e0
commit
0dbf00a055
17 files changed
+513
-53
No files matched your search
@@ -62,6 +62,8 @@ public class AlbumArtistTask : IScheduledTask
|
||||
|
||||
var dtoOptions = new DtoOptions(true);
|
||||
var updated = 0;
|
||||
var artistNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
var genreNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
for (var i = 0; i < items.Count; i++)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -136,11 +138,19 @@ public class AlbumArtistTask : IScheduledTask
|
||||
if (finalArtists.Length > 0)
|
||||
{
|
||||
item.Artists = finalArtists;
|
||||
foreach (var name in finalArtists)
|
||||
{
|
||||
artistNames.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (finalAlbumArtists.Length > 0)
|
||||
{
|
||||
item.AlbumArtists = finalAlbumArtists;
|
||||
foreach (var name in finalAlbumArtists)
|
||||
{
|
||||
artistNames.Add(name);
|
||||
}
|
||||
}
|
||||
else if (AlbumArtistCache.TryGet(item.Path, out var cached))
|
||||
{
|
||||
@@ -154,6 +164,10 @@ public class AlbumArtistTask : IScheduledTask
|
||||
if (finalGenres.Length > 0)
|
||||
{
|
||||
item.Genres = finalGenres;
|
||||
foreach (var name in finalGenres)
|
||||
{
|
||||
genreNames.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
await item.UpdateToRepositoryAsync(ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
|
||||
@@ -178,7 +192,47 @@ public class AlbumArtistTask : IScheduledTask
|
||||
progress.Report(100.0 * (i + 1) / Math.Max(1, items.Count));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Yandex Music: repaired metadata links for {Updated} tracks", updated);
|
||||
foreach (var name in artistNames)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
var artist = _libraryManager.GetArtist(name);
|
||||
if (artist is not null && artist.DateLastRefreshed == default)
|
||||
{
|
||||
artist.DateLastRefreshed = DateTime.UtcNow;
|
||||
await artist.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogWarning(ex, "Yandex Music: failed to prepare artist {Artist}", name);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var name in genreNames)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
var genre = _libraryManager.GetMusicGenre(name);
|
||||
if (genre is not null && genre.DateLastRefreshed == default)
|
||||
{
|
||||
genre.DateLastRefreshed = DateTime.UtcNow;
|
||||
await genre.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogWarning(ex, "Yandex Music: failed to prepare genre {Genre}", name);
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation(
|
||||
"Yandex Music: repaired metadata links for {Updated} tracks, prepared {Artists} artists and {Genres} genres",
|
||||
updated,
|
||||
artistNames.Count,
|
||||
genreNames.Count);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in new issue
Block a user