mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 02:56:54 +01:00
add additional view settings
This commit is contained in:
@@ -4,13 +4,13 @@ using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MoreLinq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MoreLinq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Collections
|
||||
{
|
||||
@@ -27,6 +27,12 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
_iLibraryMonitor = iLibraryMonitor;
|
||||
}
|
||||
|
||||
public Folder GetCollectionsFolder(string userId)
|
||||
{
|
||||
return _libraryManager.RootFolder.Children.Concat(_libraryManager.RootFolder.GetHiddenChildren()).OfType<ManualCollectionsFolder>()
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<BoxSet> CreateCollection(CollectionCreationOptions options)
|
||||
{
|
||||
var name = options.Name;
|
||||
@@ -104,8 +110,7 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
}
|
||||
}
|
||||
|
||||
return _libraryManager.RootFolder.Children.OfType<ManualCollectionsFolder>().FirstOrDefault() ??
|
||||
_libraryManager.RootFolder.GetHiddenChildren().OfType<ManualCollectionsFolder>().FirstOrDefault();
|
||||
return GetCollectionsFolder(string.Empty);
|
||||
}
|
||||
|
||||
public async Task AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
|
||||
|
||||
@@ -28,6 +28,11 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsHiddenFromUser(User user)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string CollectionType
|
||||
{
|
||||
get { return Model.Entities.CollectionType.BoxSets; }
|
||||
|
||||
@@ -62,28 +62,29 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (recursiveChildren.OfType<Series>().Any())
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.TvShows, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.TvShows, user, string.Empty, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (recursiveChildren.OfType<MusicAlbum>().Any() ||
|
||||
recursiveChildren.OfType<MusicVideo>().Any())
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.Music, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.Music, user, string.Empty, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (recursiveChildren.OfType<Movie>().Any())
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.Movies, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.Movies, user, string.Empty, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (recursiveChildren.OfType<Game>().Any())
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.Games, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.Games, user, string.Empty, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (recursiveChildren.OfType<BoxSet>().Any())
|
||||
if (user.Configuration.DisplayCollectionsView ||
|
||||
recursiveChildren.OfType<BoxSet>().Any())
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.BoxSets, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.BoxSets, user, "zzz_" + CollectionType.BoxSets, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (query.IncludeExternalContent)
|
||||
@@ -116,11 +117,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return list.OrderBy(i => i.SortName);
|
||||
}
|
||||
|
||||
private Task<UserView> GetUserView(string type, User user, CancellationToken cancellationToken)
|
||||
private Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
|
||||
{
|
||||
var name = _localizationManager.GetLocalizedString("ViewType" + type);
|
||||
|
||||
return _libraryManager.GetNamedView(name, type, string.Empty, cancellationToken);
|
||||
return _libraryManager.GetNamedView(name, type, sortName, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user