Fix artist metadata not being fetched on initial library scan (#16606)
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Tests / run-tests (macos-latest) (push) Has been cancelled
Tests / run-tests (ubuntu-latest) (push) Has been cancelled
Tests / run-tests (windows-latest) (push) Has been cancelled
OpenAPI Publish / OpenAPI - Publish Artifact (push) Has been cancelled
OpenAPI Publish / OpenAPI - Publish Unstable Spec (push) Has been cancelled
OpenAPI Publish / OpenAPI - Publish Stable Spec (push) Has been cancelled
Project Automation / Project board (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled

* Fix artist metadata not being fetched on initial library scan

* Update Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs

Co-authored-by: Bond-009 <bond.009@outlook.com>

---------

Co-authored-by: Bond-009 <bond.009@outlook.com>
This commit is contained in:
theguymadmax
2026-04-14 12:38:01 -04:00
committed by GitHub
parent fb33b725e0
commit 5bad7b8ae3
4 changed files with 27 additions and 3 deletions

View File

@@ -50,6 +50,10 @@ public class ArtistsValidator
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
var names = _itemRepo.GetAllArtistNames();
var existingArtistIds = _libraryManager.GetItemIds(new InternalItemsQuery
{
IncludeItemTypes = [BaseItemKind.MusicArtist]
}).ToHashSet();
var numComplete = 0;
var count = names.Count;
@@ -59,8 +63,13 @@ public class ArtistsValidator
try
{
var item = _libraryManager.GetArtist(name);
var isNew = !existingArtistIds.Contains(item.Id);
var neverRefreshed = item.DateLastRefreshed == default;
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
if (isNew || neverRefreshed)
{
await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
}
catch (OperationCanceledException)
{