blob: 9aadce88ca95fa6286dbb229f5e41e494b3230d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#nullable disable
using Emby.Naming.Common;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
namespace Emby.Server.Implementations.Library.Resolvers
{
/// <summary>
/// Resolves a Path into a Video or Video subclass.
/// </summary>
public class VideoExtraResolver : BaseVideoResolver<Video>
{
/// <summary>
/// Initializes a new instance of the <see cref="VideoExtraResolver"/> class.
/// </summary>
/// <param name="namingOptions">The naming options.</param>
public VideoExtraResolver(NamingOptions namingOptions)
: base(namingOptions)
{
}
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public override ResolverPriority Priority => ResolverPriority.Last;
/// <summary>
/// Resolves the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns>The video extra or null if not handled by this resolver.</returns>
public override Video Resolve(ItemResolveArgs args)
{
// Only handle owned items
if (args.Parent != null)
{
return null;
}
var ownedItem = base.Resolve(args);
// Re-resolve items that have their own type
if (ownedItem.ExtraType == ExtraType.Trailer)
{
ownedItem = ResolveVideo<Trailer>(args, false);
}
return ownedItem;
}
}
}
|