mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Merge branch 'feature/add-artwork-provider-system' into feature/add-artwork-provider-and-metadata-aggregation
This commit is contained in:
commit
0f872b5666
124 files changed
+9715
-74
No files matched your search
@@ -0,0 +1,38 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.Contracts.Core.Metadata;
|
||||
|
||||
/// <summary>
|
||||
/// Contract for a plugin that provides artwork for media items (i.e., covers, banners, fanart, etc).
|
||||
/// </summary>
|
||||
public interface IArtworkProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the display name of the artwork provider.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media library types this artwork provider supports.
|
||||
/// </summary>
|
||||
IReadOnlyList<LibraryType> SupportedLibraryTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this artwork provider requires access to the web to retrieve artwork.
|
||||
/// </summary>
|
||||
bool RequiresWebAccess { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the artwork of the media item described by <paramref name="lookup"/>.
|
||||
/// </summary>
|
||||
/// <param name="lookup">The lookup describing the media item to get the artwork for.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The artwork of the media item, or <see langword="null"/> when no artwork was found.</returns>
|
||||
Task<ArtworkDto?> GetArtworkAsync(MetadataLookupDto lookup, CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Plugins.Contracts.Core.Metadata;
|
||||
|
||||
/// <summary>
|
||||
/// Contract for a plugin that provides artwork for media items, typed to the media item lookup type.
|
||||
/// </summary>
|
||||
/// <typeparam name="TLookup">The type of the lookup describing the media item.</typeparam>
|
||||
public interface IArtworkProvider<TLookup> : IArtworkProvider
|
||||
where TLookup : MetadataLookupDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the artwork of the media item described by <paramref name="lookup"/>.
|
||||
/// </summary>
|
||||
/// <param name="lookup">The lookup describing the media item to get the artwork for.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The artwork of the media item, or <see langword="null"/> when no artwork was found.</returns>
|
||||
Task<ArtworkDto?> GetArtworkAsync(TLookup lookup, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the artwork of the media item described by <paramref name="lookup"/>.
|
||||
/// </summary>
|
||||
/// <param name="lookup">The lookup describing the media item to get the artwork for.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The artwork of the media item, or <see langword="null"/> when no artwork was found or the lookup is of another runtime type.</returns>
|
||||
async Task<ArtworkDto?> IArtworkProvider.GetArtworkAsync(MetadataLookupDto lookup, CancellationToken cancellationToken)
|
||||
{
|
||||
return lookup is TLookup typedLookup ? await GetArtworkAsync(typedLookup, cancellationToken).ConfigureAwait(false) : null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user