mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-17 10:58:58 -07:00
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
{
|
|
public static class ItemIdentifier<TLookupInfo>
|
|
where TLookupInfo : ItemLookupInfo
|
|
{
|
|
public static async Task FindIdentities(TLookupInfo item, IProviderManager providerManager, CancellationToken cancellationToken)
|
|
{
|
|
var providers = providerManager.GetItemIdentityProviders<TLookupInfo>();
|
|
var converters = providerManager.GetItemIdentityConverters<TLookupInfo>().ToList();
|
|
|
|
foreach (var provider in providers)
|
|
{
|
|
await provider.Identify(item);
|
|
}
|
|
|
|
bool changesMade = true;
|
|
|
|
while (changesMade)
|
|
{
|
|
changesMade = false;
|
|
|
|
foreach (var converter in converters)
|
|
{
|
|
if (await converter.Convert(item))
|
|
{
|
|
changesMade = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |