Fix People Issues (#14284)

This commit is contained in:
Tim Eisele 2025-06-12 13:21:01 +02:00 committed by GitHub
parent 6016159860
commit 9f0f9a276f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 22 deletions

View File

@ -2986,6 +2986,8 @@ namespace Emby.Server.Implementations.Library
var personEntity = GetPerson(person.Name); var personEntity = GetPerson(person.Name);
if (personEntity is null) if (personEntity is null)
{
try
{ {
var path = Person.GetPath(person.Name); var path = Person.GetPath(person.Name);
var info = Directory.CreateDirectory(path); var info = Directory.CreateDirectory(path);
@ -3003,6 +3005,12 @@ namespace Emby.Server.Implementations.Library
saveEntity = true; saveEntity = true;
createEntity = true; createEntity = true;
} }
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to create person {Name}", person.Name);
continue;
}
}
foreach (var id in person.ProviderIds) foreach (var id in person.ProviderIds)
{ {

View File

@ -262,14 +262,13 @@ namespace MediaBrowser.Providers.Manager
protected async Task SaveItemAsync(MetadataResult<TItemType> result, ItemUpdateType reason, CancellationToken cancellationToken) protected async Task SaveItemAsync(MetadataResult<TItemType> result, ItemUpdateType reason, CancellationToken cancellationToken)
{ {
await result.Item.UpdateToRepositoryAsync(reason, cancellationToken).ConfigureAwait(false);
if (result.Item.SupportsPeople && result.People is not null) if (result.Item.SupportsPeople && result.People is not null)
{ {
var baseItem = result.Item; var baseItem = result.Item;
await LibraryManager.UpdatePeopleAsync(baseItem, result.People, cancellationToken).ConfigureAwait(false); await LibraryManager.UpdatePeopleAsync(baseItem, result.People, cancellationToken).ConfigureAwait(false);
} }
await result.Item.UpdateToRepositoryAsync(reason, cancellationToken).ConfigureAwait(false);
} }
protected virtual Task AfterMetadataRefresh(TItemType item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) protected virtual Task AfterMetadataRefresh(TItemType item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)

View File

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Enums; using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
@ -53,6 +55,16 @@ public class AlbumMetadataService : MetadataService<MusicAlbum, AlbumInfo>
protected override IReadOnlyList<BaseItem> GetChildrenForMetadataUpdates(MusicAlbum item) protected override IReadOnlyList<BaseItem> GetChildrenForMetadataUpdates(MusicAlbum item)
=> item.GetRecursiveChildren(i => i is Audio); => item.GetRecursiveChildren(i => i is Audio);
/// <inheritdoc />
protected override Task AfterMetadataRefresh(MusicAlbum item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
{
base.AfterMetadataRefresh(item, refreshOptions, cancellationToken);
SetPeople(item);
return Task.CompletedTask;
}
/// <inheritdoc /> /// <inheritdoc />
protected override ItemUpdateType UpdateMetadataFromChildren(MusicAlbum item, IReadOnlyList<BaseItem> children, bool isFullRefresh, ItemUpdateType currentUpdateType) protected override ItemUpdateType UpdateMetadataFromChildren(MusicAlbum item, IReadOnlyList<BaseItem> children, bool isFullRefresh, ItemUpdateType currentUpdateType)
{ {
@ -83,7 +95,6 @@ public class AlbumMetadataService : MetadataService<MusicAlbum, AlbumInfo>
updateType |= SetArtistsFromSongs(item, songs); updateType |= SetArtistsFromSongs(item, songs);
updateType |= SetAlbumArtistFromSongs(item, songs); updateType |= SetAlbumArtistFromSongs(item, songs);
updateType |= SetAlbumFromSongs(item, songs); updateType |= SetAlbumFromSongs(item, songs);
updateType |= SetPeople(item);
} }
return updateType; return updateType;
@ -178,10 +189,8 @@ public class AlbumMetadataService : MetadataService<MusicAlbum, AlbumInfo>
} }
} }
private ItemUpdateType SetPeople(MusicAlbum item) private void SetPeople(MusicAlbum item)
{ {
var updateType = ItemUpdateType.None;
if (item.AlbumArtists.Any() || item.Artists.Any()) if (item.AlbumArtists.Any() || item.Artists.Any())
{ {
var people = new List<PersonInfo>(); var people = new List<PersonInfo>();
@ -205,10 +214,7 @@ public class AlbumMetadataService : MetadataService<MusicAlbum, AlbumInfo>
} }
LibraryManager.UpdatePeople(item, people); LibraryManager.UpdatePeople(item, people);
updateType |= ItemUpdateType.MetadataEdit;
} }
return updateType;
} }
/// <inheritdoc /> /// <inheritdoc />