using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
namespace MediaBrowser.Controller.Resolvers
{
///
/// Class ItemResolver
///
///
public abstract class ItemResolver : IItemResolver
where T : BaseItem, new()
{
///
/// Resolves the specified args.
///
/// The args.
/// `0.
protected virtual T Resolve(ItemResolveArgs args)
{
return null;
}
///
/// Gets the priority.
///
/// The priority.
public virtual ResolverPriority Priority
{
get
{
return ResolverPriority.First;
}
}
///
/// Sets initial values on the newly resolved item
///
/// The item.
/// The args.
protected virtual void SetInitialItemValues(T item, ItemResolveArgs args)
{
}
///
/// Resolves the path.
///
/// The args.
/// BaseItem.
BaseItem IItemResolver.ResolvePath(ItemResolveArgs args)
{
var item = Resolve(args);
if (item != null)
{
SetInitialItemValues(item, args);
}
return item;
}
}
}