jellyfin-server/MediaBrowser.Controller/Resolvers/FolderResolver.cs

37 lines
1.1 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using System.ComponentModel.Composition;
2012-07-12 06:55:27 +00:00
namespace MediaBrowser.Controller.Resolvers
{
[Export(typeof(IBaseItemResolver))]
2012-07-12 06:55:27 +00:00
public class FolderResolver : BaseFolderResolver<Folder>
{
public override ResolverPriority Priority
{
get { return ResolverPriority.Last; }
}
2012-07-12 06:55:27 +00:00
protected override Folder Resolve(ItemResolveEventArgs args)
{
2012-09-18 20:07:17 +00:00
if (args.IsDirectory && !args.FileInfo.cFileName.Equals("metadata",System.StringComparison.OrdinalIgnoreCase))
2012-07-12 06:55:27 +00:00
{
return new Folder() { PhysicalLocations = args.PhysicalLocations };
2012-07-12 06:55:27 +00:00
}
return null;
}
}
public abstract class BaseFolderResolver<TItemType> : BaseItemResolver<TItemType>
where TItemType : Folder, new()
2012-07-12 06:55:27 +00:00
{
protected override void SetInitialItemValues(TItemType item, ItemResolveEventArgs args)
2012-07-12 06:55:27 +00:00
{
base.SetInitialItemValues(item, args);
2012-07-12 06:55:27 +00:00
item.IsRoot = args.Parent == null;
}
}
}