mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 06:17:14 -04:00
restore video grouping feature
This commit is contained in:
parent
51c3f270ae
commit
994cc020f8
@ -20,6 +20,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public static IUserManager UserManager { get; set; }
|
||||
public static IXmlSerializer XmlSerializer { get; set; }
|
||||
public bool EnableUserViews { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// From now on all user paths will be Id-based.
|
||||
|
@ -433,6 +433,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
}
|
||||
|
||||
var item = _libraryManager.GetItemById(id) as Channel;
|
||||
var channelId = channelInfo.Name.GetMD5().ToString("N");
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
@ -443,13 +444,12 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
DateCreated = _fileSystem.GetCreationTimeUtc(path),
|
||||
DateModified = _fileSystem.GetLastWriteTimeUtc(path),
|
||||
Path = path,
|
||||
ChannelId = channelInfo.Name.GetMD5().ToString("N")
|
||||
ChannelId = channelId
|
||||
};
|
||||
|
||||
isNew = true;
|
||||
}
|
||||
|
||||
var channelId = channelInfo.Name.GetMD5().ToString("N");
|
||||
if (!string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
isNew = true;
|
||||
@ -459,7 +459,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
item.Overview = channelInfo.Description;
|
||||
item.HomePageUrl = channelInfo.HomePageUrl;
|
||||
|
||||
if (string.IsNullOrEmpty(item.Name))
|
||||
if (string.IsNullOrWhiteSpace(item.Name))
|
||||
{
|
||||
item.Name = channelInfo.Name;
|
||||
}
|
||||
@ -497,9 +497,14 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
|
||||
public IEnumerable<ChannelFeatures> GetAllChannelFeatures()
|
||||
{
|
||||
return GetAllChannels()
|
||||
.Select(GetChannelEntity)
|
||||
.OrderBy(i => i.SortName)
|
||||
var inputItems = _libraryManager.GetItems(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Channel).Name },
|
||||
SortBy = new[] { ItemSortBy.SortName }
|
||||
|
||||
}).Items;
|
||||
|
||||
return inputItems
|
||||
.Select(i => GetChannelFeatures(i.Id.ToString("N")));
|
||||
}
|
||||
|
||||
|
@ -707,7 +707,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
Id = Guid.NewGuid(),
|
||||
DateCreated = DateTime.UtcNow,
|
||||
DateModified = DateTime.UtcNow,
|
||||
UsesIdForConfigurationPath = true
|
||||
UsesIdForConfigurationPath = true,
|
||||
EnableUserViews = true
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
var list = new List<Folder>();
|
||||
|
||||
if (_config.Configuration.EnableUserViews)
|
||||
var enableUserViews = _config.Configuration.EnableUserViews || user.EnableUserViews;
|
||||
|
||||
if (enableUserViews)
|
||||
{
|
||||
foreach (var folder in standaloneFolders)
|
||||
{
|
||||
@ -118,7 +120,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (parents.Count > 0)
|
||||
{
|
||||
list.Add(await GetUserView(parents, list, CollectionType.TvShows, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(parents, list, CollectionType.TvShows, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
parents = foldersWithViewTypes.Where(i => string.Equals(i.GetViewType(user), CollectionType.Music, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.GetViewType(user)))
|
||||
@ -126,7 +128,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (parents.Count > 0)
|
||||
{
|
||||
list.Add(await GetUserView(parents, list, CollectionType.Music, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(parents, list, CollectionType.Music, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
parents = foldersWithViewTypes.Where(i => string.Equals(i.GetViewType(user), CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.GetViewType(user)))
|
||||
@ -134,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (parents.Count > 0)
|
||||
{
|
||||
list.Add(await GetUserView(parents, list, CollectionType.Movies, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(parents, list, CollectionType.Movies, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
parents = foldersWithViewTypes.Where(i => string.Equals(i.GetViewType(user), CollectionType.Games, StringComparison.OrdinalIgnoreCase))
|
||||
@ -142,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (parents.Count > 0)
|
||||
{
|
||||
list.Add(await GetUserView(parents, list, CollectionType.Games, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(parents, list, CollectionType.Games, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (user.Configuration.DisplayFoldersView)
|
||||
@ -207,10 +209,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return GetUserSubView(name, parentId, type, sortName, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<UserView> GetUserView(List<ICollectionFolder> parents, List<Folder> currentViews, string viewType, string sortName, User user, CancellationToken cancellationToken)
|
||||
private async Task<UserView> GetUserView(List<ICollectionFolder> parents, List<Folder> currentViews, string viewType, string sortName, User user, bool enableUserViews, CancellationToken cancellationToken)
|
||||
{
|
||||
var enableUserViews = _config.Configuration.EnableUserViews;
|
||||
|
||||
if (parents.Count == 1 && parents.All(i => string.Equals((enableUserViews ? i.GetViewType(user) : i.CollectionType), viewType, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var parentId = parents[0].Id;
|
||||
|
Loading…
Reference in New Issue
Block a user