2019-01-13 12:54:44 -07:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2013-03-02 23:58:04 -07:00
|
|
|
using MediaBrowser.Controller.Library;
|
2013-03-03 09:53:58 -07:00
|
|
|
using MediaBrowser.Controller.Resolvers;
|
2013-03-02 23:58:04 -07:00
|
|
|
|
2016-11-02 23:37:52 -07:00
|
|
|
namespace Emby.Server.Implementations.Library.Resolvers
|
2013-03-02 23:58:04 -07:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Class ItemResolver
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
public abstract class ItemResolver<T> : IItemResolver
|
|
|
|
where T : BaseItem, new()
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Resolves the specified args.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
/// <returns>`0.</returns>
|
|
|
|
protected virtual T Resolve(ItemResolveArgs args)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the priority.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The priority.</value>
|
2019-01-06 13:50:43 -07:00
|
|
|
public virtual ResolverPriority Priority => ResolverPriority.First;
|
2013-03-02 23:58:04 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sets initial values on the newly resolved item
|
|
|
|
/// </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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|