fixes #433 - Add root collection type to ItemResolveArgs
This commit is contained in:
parent
dfe91e43b6
commit
e7e18af2d7
|
@ -327,7 +327,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (LocationType == LocationType.Remote || LocationType == LocationType.Virtual)
|
if (LocationType == LocationType.Remote || LocationType == LocationType.Virtual)
|
||||||
{
|
{
|
||||||
return new ItemResolveArgs(ConfigurationManager.ApplicationPaths);
|
return new ItemResolveArgs(ConfigurationManager.ApplicationPaths, LibraryManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
var isDirectory = false;
|
var isDirectory = false;
|
||||||
|
@ -345,7 +345,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
throw new IOException("Unable to retrieve file system info for " + path);
|
throw new IOException("Unable to retrieve file system info for " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths)
|
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, LibraryManager)
|
||||||
{
|
{
|
||||||
FileInfo = pathInfo,
|
FileInfo = pathInfo,
|
||||||
Path = path,
|
Path = path,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.IO;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -17,14 +16,17 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// The _app paths
|
/// The _app paths
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
|
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appPaths">The app paths.</param>
|
/// <param name="appPaths">The app paths.</param>
|
||||||
public ItemResolveArgs(IServerApplicationPaths appPaths)
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
|
public ItemResolveArgs(IServerApplicationPaths appPaths, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -368,6 +370,11 @@ namespace MediaBrowser.Controller.Library
|
||||||
return GetFileSystemEntryByName(name) != null;
|
return GetFileSystemEntryByName(name) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetCollectionType()
|
||||||
|
{
|
||||||
|
return Parent == null ? null : _libraryManager.FindCollectionType(Parent);
|
||||||
|
}
|
||||||
|
|
||||||
#region Equality Overrides
|
#region Equality Overrides
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -441,7 +441,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
throw new ArgumentNullException("fileInfo");
|
throw new ArgumentNullException("fileInfo");
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths)
|
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, this)
|
||||||
{
|
{
|
||||||
Parent = parent,
|
Parent = parent,
|
||||||
Path = fileInfo.FullName,
|
Path = fileInfo.FullName,
|
||||||
|
|
|
@ -14,13 +14,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MusicAlbumResolver : ItemResolver<MusicAlbum>
|
public class MusicAlbumResolver : ItemResolver<MusicAlbum>
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
|
|
||||||
public MusicAlbumResolver(ILibraryManager libraryManager)
|
|
||||||
{
|
|
||||||
_libraryManager = libraryManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the priority.
|
/// Gets the priority.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -44,7 +37,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
if (args.Parent.IsRoot) return null;
|
if (args.Parent.IsRoot) return null;
|
||||||
if (args.Parent is MusicAlbum) return null;
|
if (args.Parent is MusicAlbum) return null;
|
||||||
|
|
||||||
var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
// If there's a collection type and it's not music, it can't be a series
|
// If there's a collection type and it's not music, it can't be a series
|
||||||
if (!string.IsNullOrEmpty(collectionType) &&
|
if (!string.IsNullOrEmpty(collectionType) &&
|
||||||
|
|
|
@ -13,13 +13,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MusicArtistResolver : ItemResolver<MusicArtist>
|
public class MusicArtistResolver : ItemResolver<MusicArtist>
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
|
|
||||||
public MusicArtistResolver(ILibraryManager libraryManager)
|
|
||||||
{
|
|
||||||
_libraryManager = libraryManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the priority.
|
/// Gets the priority.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -48,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
// If there's a collection type and it's not music, it can't be a series
|
// If there's a collection type and it's not music, it can't be a series
|
||||||
if (!string.IsNullOrEmpty(collectionType) &&
|
if (!string.IsNullOrEmpty(collectionType) &&
|
||||||
|
|
|
@ -17,12 +17,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MovieResolver : BaseVideoResolver<Video>
|
public class MovieResolver : BaseVideoResolver<Video>
|
||||||
{
|
{
|
||||||
private IServerApplicationPaths ApplicationPaths { get; set; }
|
private readonly IServerApplicationPaths _applicationPaths;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public MovieResolver(IServerApplicationPaths appPaths, ILibraryManager libraryManager)
|
public MovieResolver(IServerApplicationPaths appPaths, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
ApplicationPaths = appPaths;
|
_applicationPaths = appPaths;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
// Find movies with their own folders
|
// Find movies with their own folders
|
||||||
if (isDirectory)
|
if (isDirectory)
|
||||||
|
@ -234,7 +234,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var childArgs = new ItemResolveArgs(ApplicationPaths)
|
var childArgs = new ItemResolveArgs(_applicationPaths, _libraryManager)
|
||||||
{
|
{
|
||||||
FileInfo = child,
|
FileInfo = child,
|
||||||
Path = child.FullName
|
Path = child.FullName
|
||||||
|
|
|
@ -13,13 +13,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SeriesResolver : FolderResolver<Series>
|
public class SeriesResolver : FolderResolver<Series>
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
|
|
||||||
public SeriesResolver(ILibraryManager libraryManager)
|
|
||||||
{
|
|
||||||
_libraryManager = libraryManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the priority.
|
/// Gets the priority.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -53,7 +46,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
// If there's a collection type and it's not tv, it can't be a series
|
// If there's a collection type and it's not tv, it can't be a series
|
||||||
if (!string.IsNullOrEmpty(collectionType) &&
|
if (!string.IsNullOrEmpty(collectionType) &&
|
||||||
|
|
Loading…
Reference in New Issue
Block a user