2013-02-21 01:33:05 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2014-11-16 20:44:08 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2013-03-03 16:53:58 +00:00
|
|
|
|
using MediaBrowser.Controller.Resolvers;
|
2014-11-16 20:44:08 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
2013-02-21 01:33:05 +00:00
|
|
|
|
|
2013-03-03 06:58:04 +00:00
|
|
|
|
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
2013-02-21 01:33:05 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves a Path into a Video
|
|
|
|
|
/// </summary>
|
2013-03-03 16:53:58 +00:00
|
|
|
|
public class VideoResolver : BaseVideoResolver<Video>
|
2013-02-21 01:33:05 +00:00
|
|
|
|
{
|
2014-11-16 20:44:08 +00:00
|
|
|
|
public VideoResolver(ILibraryManager libraryManager)
|
|
|
|
|
: base(libraryManager)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Video Resolve(ItemResolveArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Parent != null)
|
|
|
|
|
{
|
|
|
|
|
var collectionType = args.GetCollectionType() ?? string.Empty;
|
|
|
|
|
var accepted = new[]
|
|
|
|
|
{
|
|
|
|
|
string.Empty,
|
|
|
|
|
CollectionType.HomeVideos
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!accepted.Contains(collectionType, StringComparer.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.Resolve(args);
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-21 01:33:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the priority.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The priority.</value>
|
|
|
|
|
public override ResolverPriority Priority
|
|
|
|
|
{
|
|
|
|
|
get { return ResolverPriority.Last; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|