mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
Fix resolved type for Trailers
This commit is contained in:
committed by
Cody Robibero (Rebase PR Action)
parent
60e75f7b70
commit
c0ab54f0bd
@@ -1,18 +0,0 @@
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using Emby.Naming.Common;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
public class GenericVideoResolver<T> : BaseVideoResolver<T>
|
||||
where T : Video, new()
|
||||
{
|
||||
public GenericVideoResolver(NamingOptions namingOptions)
|
||||
: base(namingOptions)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,10 +105,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
|
||||
if (string.IsNullOrEmpty(collectionType))
|
||||
{
|
||||
// Owned items will be caught by the plain video resolver
|
||||
// Owned items will be caught by the video extra resolver
|
||||
if (args.Parent == null)
|
||||
{
|
||||
// return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -129,10 +128,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
return movie?.ExtraType == null ? movie : null;
|
||||
}
|
||||
|
||||
// Handle owned items
|
||||
// Owned items will be caught by the video extra resolver
|
||||
if (args.Parent == null)
|
||||
{
|
||||
return base.Resolve(args);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (IsInvalid(args.Parent, collectionType))
|
||||
|
||||
@@ -0,0 +1,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user