aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Controller/Entities/User.cs1
-rw-r--r--MediaBrowser.Server.Implementations/Channels/ChannelManager.cs17
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserManager.cs3
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserViewManager.cs16
4 files changed, 22 insertions, 15 deletions
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index bf0f7a2a8..a9e314ede 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -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.
diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
index 70005725f..99d2a03f9 100644
--- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
+++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs
@@ -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")));
}
diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs
index 3ef625db6..3c29cf15d 100644
--- a/MediaBrowser.Server.Implementations/Library/UserManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs
@@ -707,7 +707,8 @@ namespace MediaBrowser.Server.Implementations.Library
Id = Guid.NewGuid(),
DateCreated = DateTime.UtcNow,
DateModified = DateTime.UtcNow,
- UsesIdForConfigurationPath = true
+ UsesIdForConfigurationPath = true,
+ EnableUserViews = true
};
}
diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
index ffbc89c94..c2938475c 100644
--- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
@@ -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;