| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.Threading; |
| | | 4 | | using System.Threading.Tasks; |
| | | 5 | | using MediaBrowser.Controller.Entities; |
| | | 6 | | |
| | | 7 | | namespace MediaBrowser.Controller.Library; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Provides similar items from the local library. |
| | | 11 | | /// Returns fully resolved BaseItems directly - no additional resolution needed. |
| | | 12 | | /// </summary> |
| | | 13 | | public interface ILocalSimilarItemsProvider : ISimilarItemsProvider |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Determines whether the provider can handle items of the specified type. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <param name="itemType">The item type.</param> |
| | | 19 | | /// <returns><c>true</c> if the provider handles this item type; otherwise <c>false</c>.</returns> |
| | | 20 | | bool Supports(Type itemType); |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets similar items from the local library. |
| | | 24 | | /// </summary> |
| | | 25 | | /// <param name="item">The source item to find similar items for.</param> |
| | | 26 | | /// <param name="query">The query options (user, limit, exclusions, etc.).</param> |
| | | 27 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | | 28 | | /// <returns>The list of similar items from the library.</returns> |
| | | 29 | | Task<IReadOnlyList<BaseItem>> GetSimilarItemsAsync( |
| | | 30 | | BaseItem item, |
| | | 31 | | SimilarItemsQuery query, |
| | | 32 | | CancellationToken cancellationToken); |
| | | 33 | | } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Provides similar items from the local library for a specific item type. |
| | | 37 | | /// Returns fully resolved BaseItems directly - no additional resolution needed. |
| | | 38 | | /// </summary> |
| | | 39 | | /// <typeparam name="TItemType">The type of item this provider handles.</typeparam> |
| | | 40 | | public interface ILocalSimilarItemsProvider<TItemType> : ILocalSimilarItemsProvider |
| | | 41 | | where TItemType : BaseItem |
| | | 42 | | { |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets similar items from the local library. |
| | | 45 | | /// </summary> |
| | | 46 | | /// <param name="item">The source item to find similar items for.</param> |
| | | 47 | | /// <param name="query">The query options (user, limit, exclusions, etc.).</param> |
| | | 48 | | /// <param name="cancellationToken">Cancellation token.</param> |
| | | 49 | | /// <returns>The list of similar items from the library.</returns> |
| | | 50 | | Task<IReadOnlyList<BaseItem>> GetSimilarItemsAsync( |
| | | 51 | | TItemType item, |
| | | 52 | | SimilarItemsQuery query, |
| | | 53 | | CancellationToken cancellationToken); |
| | | 54 | | |
| | | 55 | | bool ILocalSimilarItemsProvider.Supports(Type itemType) |
| | 0 | 56 | | => typeof(TItemType).IsAssignableFrom(itemType); |
| | | 57 | | |
| | | 58 | | Task<IReadOnlyList<BaseItem>> ILocalSimilarItemsProvider.GetSimilarItemsAsync( |
| | | 59 | | BaseItem item, |
| | | 60 | | SimilarItemsQuery query, |
| | | 61 | | CancellationToken cancellationToken) |
| | 0 | 62 | | => GetSimilarItemsAsync((TItemType)item, query, cancellationToken); |
| | | 63 | | } |