Adding a game now immediately provides a dialog to lookup a game through metadata providers. Selecting a result will create the game with the populated metadata. An additional option of automatically downloading art (icon, cover, background, logo) is also provided, though may be inaccurate and completely up to the results of the provider.
21 lines
No EOL
665 B
C#
21 lines
No EOL
665 B
C#
using LANCommander.Server.Services.Providers.Metadata;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LANCommander.Server.Services;
|
|
|
|
public class MetadataService(IServiceProvider serviceProvider)
|
|
{
|
|
public IEnumerable<string> GetProviderNames()
|
|
{
|
|
var providers = serviceProvider.GetServices<IMetadataProvider>();
|
|
|
|
return providers.Where(p => p.IsAvailable).Select(p => p.ProviderName);
|
|
}
|
|
|
|
public IMetadataProvider? GetProvider(string providerName)
|
|
{
|
|
var providers = serviceProvider.GetServices<IMetadataProvider>();
|
|
|
|
return providers.FirstOrDefault(p => p.ProviderName == providerName);
|
|
}
|
|
} |