2019-01-13 15:01:16 -05:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2018-12-27 18:27:57 -05:00
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Resolvers
|
|
|
|
{
|
|
|
|
/// <summary>
|
2020-06-15 18:37:52 -04:00
|
|
|
/// Class ItemResolver.
|
2018-12-27 18:27:57 -05:00
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
public abstract class ItemResolver<T> : IItemResolver
|
|
|
|
where T : BaseItem, new()
|
|
|
|
{
|
2021-05-05 09:30:32 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the priority.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The priority.</value>
|
|
|
|
public virtual ResolverPriority Priority => ResolverPriority.First;
|
|
|
|
|
2018-12-27 18:27:57 -05:00
|
|
|
/// <summary>
|
|
|
|
/// Resolves the specified args.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
/// <returns>`0.</returns>
|
2021-03-14 14:56:45 -04:00
|
|
|
public virtual T Resolve(ItemResolveArgs args)
|
2018-12-27 18:27:57 -05:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 18:37:52 -04:00
|
|
|
/// Sets initial values on the newly resolved item.
|
2018-12-27 18:27:57 -05:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
protected virtual void SetInitialItemValues(T item, ItemResolveArgs args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Resolves the path.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
/// <returns>BaseItem.</returns>
|
|
|
|
BaseItem IItemResolver.ResolvePath(ItemResolveArgs args)
|
|
|
|
{
|
|
|
|
var item = Resolve(args);
|
|
|
|
|
|
|
|
if (item != null)
|
|
|
|
{
|
|
|
|
SetInitialItemValues(item, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|