mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-25 06:58:40 +02:00
factor collection type in resolving process
This commit is contained in:
parent
a4142e8764
commit
898d55d866
|
@ -240,6 +240,22 @@ namespace MediaBrowser.Model.ApiClient
|
||||||
/// <exception cref="ArgumentNullException">userId</exception>
|
/// <exception cref="ArgumentNullException">userId</exception>
|
||||||
Task<BaseItemDto> GetGenreAsync(string name, string userId);
|
Task<BaseItemDto> GetGenreAsync(string name, string userId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the music genre async.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
/// <param name="userId">The user id.</param>
|
||||||
|
/// <returns>Task{BaseItemDto}.</returns>
|
||||||
|
Task<BaseItemDto> GetMusicGenreAsync(string name, string userId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the game genre async.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
/// <param name="userId">The user id.</param>
|
||||||
|
/// <returns>Task{BaseItemDto}.</returns>
|
||||||
|
Task<BaseItemDto> GetGameGenreAsync(string name, string userId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the artist async.
|
/// Gets the artist async.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -12,6 +14,13 @@ 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>
|
||||||
|
@ -35,6 +44,15 @@ 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);
|
||||||
|
|
||||||
|
// If there's a collection type and it's not music, it can't be a series
|
||||||
|
if (!string.IsNullOrEmpty(collectionType) &&
|
||||||
|
!string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return IsMusicAlbum(args) ? new MusicAlbum
|
return IsMusicAlbum(args) ? new MusicAlbum
|
||||||
{
|
{
|
||||||
DisplayMediaType = "Album"
|
DisplayMediaType = "Album"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -11,6 +13,13 @@ 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>
|
||||||
|
@ -39,6 +48,15 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
|
||||||
|
|
||||||
|
// If there's a collection type and it's not music, it can't be a series
|
||||||
|
if (!string.IsNullOrEmpty(collectionType) &&
|
||||||
|
!string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// If we contain an album assume we are an artist folder
|
// If we contain an album assume we are an artist folder
|
||||||
return args.FileSystemChildren.Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory).Any(i => MusicAlbumResolver.IsMusicAlbum(i.FullName)) ? new MusicArtist() : null;
|
return args.FileSystemChildren.Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory).Any(i => MusicAlbumResolver.IsMusicAlbum(i.FullName)) ? new MusicArtist() : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,13 @@ 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>
|
||||||
|
@ -46,6 +53,15 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
|
||||||
|
|
||||||
|
// If there's a collection type and it's not tv, it can't be a series
|
||||||
|
if (!string.IsNullOrEmpty(collectionType) &&
|
||||||
|
!string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// It's a Series if any of the following conditions are met:
|
// It's a Series if any of the following conditions are met:
|
||||||
// series.xml exists
|
// series.xml exists
|
||||||
// [tvdbid= is present in the path
|
// [tvdbid= is present in the path
|
||||||
|
|
Loading…
Reference in a new issue