2013-02-21 01:33:05 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2013-03-03 16:53:58 +00:00
|
|
|
|
using MediaBrowser.Controller.Resolvers;
|
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>
|
|
|
|
|
/// Class LocalTrailerResolver
|
|
|
|
|
/// </summary>
|
2013-03-03 16:53:58 +00:00
|
|
|
|
public class LocalTrailerResolver : BaseVideoResolver<Trailer>
|
2013-02-21 01:33:05 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves the specified args.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
|
/// <returns>Trailer.</returns>
|
|
|
|
|
protected override Trailer Resolve(ItemResolveArgs args)
|
|
|
|
|
{
|
|
|
|
|
// Trailers are not Children, therefore this can never happen
|
|
|
|
|
if (args.Parent != null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the file is within a trailers folder, see if the VideoResolver returns something
|
|
|
|
|
if (!args.IsDirectory)
|
|
|
|
|
{
|
|
|
|
|
if (string.Equals(Path.GetFileName(Path.GetDirectoryName(args.Path)), BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return base.Resolve(args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|