mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
added user view setting
This commit is contained in:
parent
064b5e82e4
commit
c90cdef3ba
@ -156,6 +156,7 @@
|
|||||||
<Compile Include="UserLibrary\PlaystateService.cs" />
|
<Compile Include="UserLibrary\PlaystateService.cs" />
|
||||||
<Compile Include="UserLibrary\StudiosService.cs" />
|
<Compile Include="UserLibrary\StudiosService.cs" />
|
||||||
<Compile Include="UserLibrary\UserLibraryService.cs" />
|
<Compile Include="UserLibrary\UserLibraryService.cs" />
|
||||||
|
<Compile Include="UserLibrary\UserViewsService.cs" />
|
||||||
<Compile Include="UserLibrary\YearsService.cs" />
|
<Compile Include="UserLibrary\YearsService.cs" />
|
||||||
<Compile Include="UserService.cs" />
|
<Compile Include="UserService.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
@ -66,6 +66,7 @@ namespace MediaBrowser.Api
|
|||||||
_config.Configuration.EnableStandaloneMetadata = true;
|
_config.Configuration.EnableStandaloneMetadata = true;
|
||||||
_config.Configuration.EnableLibraryMetadataSubFolder = true;
|
_config.Configuration.EnableLibraryMetadataSubFolder = true;
|
||||||
_config.Configuration.EnableUserSpecificUserViews = true;
|
_config.Configuration.EnableUserSpecificUserViews = true;
|
||||||
|
_config.Configuration.EnableUserSpecificUserViews2 = true;
|
||||||
_config.SaveConfiguration();
|
_config.SaveConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,20 +38,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Users/{UserId}/Views", "GET")]
|
|
||||||
public class GetUserViews : IReturn<QueryResult<BaseItemDto>>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the user id.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The user id.</value>
|
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
||||||
public string UserId { get; set; }
|
|
||||||
|
|
||||||
[ApiMember(Name = "IncludeExternalContent", Description = "Whether or not to include external views such as channels or live tv", IsRequired = true, DataType = "boolean", ParameterType = "query", Verb = "POST")]
|
|
||||||
public bool? IncludeExternalContent { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class GetItem
|
/// Class GetItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -345,37 +331,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
return ToOptimizedResult(dtos.ToList());
|
return ToOptimizedResult(dtos.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<object> Get(GetUserViews request)
|
|
||||||
{
|
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
|
||||||
|
|
||||||
var query = new UserViewQuery
|
|
||||||
{
|
|
||||||
UserId = request.UserId
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
if (request.IncludeExternalContent.HasValue)
|
|
||||||
{
|
|
||||||
query.IncludeExternalContent = request.IncludeExternalContent.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
var folders = await _userViewManager.GetUserViews(query, CancellationToken.None).ConfigureAwait(false);
|
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
|
||||||
|
|
||||||
var dtos = folders.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user))
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
var result = new QueryResult<BaseItemDto>
|
|
||||||
{
|
|
||||||
Items = dtos,
|
|
||||||
TotalRecordCount = dtos.Length
|
|
||||||
};
|
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<BaseItemDto> GetAsync(GetSpecialFeatures request)
|
private List<BaseItemDto> GetAsync(GetSpecialFeatures request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
121
MediaBrowser.Api/UserLibrary/UserViewsService.cs
Normal file
121
MediaBrowser.Api/UserLibrary/UserViewsService.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using MediaBrowser.Controller.Dto;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Library;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
|
using ServiceStack;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Api.UserLibrary
|
||||||
|
{
|
||||||
|
[Route("/Users/{UserId}/Views", "GET")]
|
||||||
|
public class GetUserViews : IReturn<QueryResult<BaseItemDto>>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user id.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The user id.</value>
|
||||||
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
|
public string UserId { get; set; }
|
||||||
|
|
||||||
|
[ApiMember(Name = "IncludeExternalContent", Description = "Whether or not to include external views such as channels or live tv", IsRequired = true, DataType = "boolean", ParameterType = "query", Verb = "POST")]
|
||||||
|
public bool? IncludeExternalContent { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("/Users/{UserId}/SpecialViewOptions", "GET")]
|
||||||
|
public class GetSpecialViewOptions : IReturn<List<SpecialViewOption>>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user id.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The user id.</value>
|
||||||
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
|
public string UserId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UserViewsService : BaseApiService
|
||||||
|
{
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IUserViewManager _userViewManager;
|
||||||
|
private readonly IDtoService _dtoService;
|
||||||
|
|
||||||
|
public UserViewsService(IUserManager userManager, IUserViewManager userViewManager, IDtoService dtoService)
|
||||||
|
{
|
||||||
|
_userManager = userManager;
|
||||||
|
_userViewManager = userViewManager;
|
||||||
|
_dtoService = dtoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<object> Get(GetUserViews request)
|
||||||
|
{
|
||||||
|
var query = new UserViewQuery
|
||||||
|
{
|
||||||
|
UserId = request.UserId
|
||||||
|
};
|
||||||
|
|
||||||
|
if (request.IncludeExternalContent.HasValue)
|
||||||
|
{
|
||||||
|
query.IncludeExternalContent = request.IncludeExternalContent.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
var folders = await _userViewManager.GetUserViews(query, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
|
var dtos = folders.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
var result = new QueryResult<BaseItemDto>
|
||||||
|
{
|
||||||
|
Items = dtos,
|
||||||
|
TotalRecordCount = dtos.Length
|
||||||
|
};
|
||||||
|
|
||||||
|
return ToOptimizedResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<object> Get(GetSpecialViewOptions request)
|
||||||
|
{
|
||||||
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
|
var views = user.RootFolder
|
||||||
|
.GetChildren(user, true)
|
||||||
|
.OfType<CollectionFolder>()
|
||||||
|
.Where(i => IsEligibleForSpecialView(i))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var list = views
|
||||||
|
.Select(i => new SpecialViewOption
|
||||||
|
{
|
||||||
|
Name = i.Name,
|
||||||
|
Id = i.Id.ToString("N")
|
||||||
|
|
||||||
|
})
|
||||||
|
.OrderBy(i => i.Name)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return ToOptimizedResult(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsEligibleForSpecialView(CollectionFolder view)
|
||||||
|
{
|
||||||
|
var types = new[] { CollectionType.Movies, CollectionType.TvShows, CollectionType.Games, CollectionType.Music };
|
||||||
|
|
||||||
|
return types.Contains(view.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SpecialViewOption
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
@ -9,6 +10,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
string CollectionType { get; }
|
string CollectionType { get; }
|
||||||
string Path { get; }
|
string Path { get; }
|
||||||
|
string Name { get; }
|
||||||
|
Guid Id { get; }
|
||||||
IEnumerable<string> PhysicalLocations { get; }
|
IEnumerable<string> PhysicalLocations { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,16 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return GetFavoriteSongs(queryParent, user, query);
|
return GetFavoriteSongs(queryParent, user, query);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return GetResult(GetMediaFolders(user).SelectMany(i => i.GetChildren(user, true)), queryParent, query);
|
{
|
||||||
|
if (queryParent is UserView)
|
||||||
|
{
|
||||||
|
return GetResult(GetMediaFolders(user).SelectMany(i => i.GetChildren(user, true)), queryParent, query);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GetResult(queryParent.GetChildren(user, true), queryParent, query);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,12 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [enable user specific user views]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [enable user specific user views]; otherwise, <c>false</c>.</value>
|
||||||
public bool EnableUserSpecificUserViews { get; set; }
|
public bool EnableUserSpecificUserViews { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [enable user specific user views2].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [enable user specific user views2]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool EnableUserSpecificUserViews2 { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
|
/// Gets or sets the value pointing to the file system where the ssl certiifcate is located..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -46,6 +46,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
public bool EnableCinemaMode { get; set; }
|
public bool EnableCinemaMode { get; set; }
|
||||||
|
|
||||||
public string[] LatestItemsExcludes { get; set; }
|
public string[] LatestItemsExcludes { get; set; }
|
||||||
|
public string[] PlainFolderViews { get; set; }
|
||||||
|
|
||||||
public bool HidePlayedInLatest { get; set; }
|
public bool HidePlayedInLatest { get; set; }
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
DisplayChannelsWithinViews = new string[] { };
|
DisplayChannelsWithinViews = new string[] { };
|
||||||
|
|
||||||
ExcludeFoldersFromGrouping = new string[] { };
|
ExcludeFoldersFromGrouping = new string[] { };
|
||||||
|
PlainFolderViews = new string[] { };
|
||||||
DisplayCollectionsView = true;
|
DisplayCollectionsView = true;
|
||||||
|
|
||||||
IncludeTrailersInSuggestions = true;
|
IncludeTrailersInSuggestions = true;
|
||||||
|
@ -1,153 +0,0 @@
|
|||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Providers;
|
|
||||||
using MediaBrowser.Providers.Genres;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.FolderImages
|
|
||||||
{
|
|
||||||
public class DefaultImageProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
|
|
||||||
{
|
|
||||||
private readonly IHttpClient _httpClient;
|
|
||||||
|
|
||||||
public DefaultImageProvider(IHttpClient httpClient)
|
|
||||||
{
|
|
||||||
_httpClient = httpClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
|
||||||
{
|
|
||||||
return new List<ImageType>
|
|
||||||
{
|
|
||||||
ImageType.Primary,
|
|
||||||
ImageType.Thumb
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var view = item as UserView;
|
|
||||||
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
return GetImages(view.ViewType, view.ParentId != Guid.Empty, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
var folder = (ICollectionFolder)item;
|
|
||||||
return GetImages(folder.CollectionType, false, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task<IEnumerable<RemoteImageInfo>> GetImages(string viewType, bool isSubView, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var url = GetImageUrl(viewType, isSubView);
|
|
||||||
var list = new List<RemoteImageInfo>();
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(url))
|
|
||||||
{
|
|
||||||
list.AddRange(new List<RemoteImageInfo>
|
|
||||||
{
|
|
||||||
new RemoteImageInfo
|
|
||||||
{
|
|
||||||
ProviderName = Name,
|
|
||||||
Url = url,
|
|
||||||
Type = ImageType.Primary
|
|
||||||
},
|
|
||||||
|
|
||||||
new RemoteImageInfo
|
|
||||||
{
|
|
||||||
ProviderName = Name,
|
|
||||||
Url = url,
|
|
||||||
Type = ImageType.Thumb
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.FromResult<IEnumerable<RemoteImageInfo>>(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetImageUrl(string viewType, bool isSubView)
|
|
||||||
{
|
|
||||||
const string urlPrefix = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Resources/master/images/folders/";
|
|
||||||
|
|
||||||
if (string.Equals(viewType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.Games, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.Music, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.Channels, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.LiveTv, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (string.Equals(viewType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isSubView)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return urlPrefix + "generic.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "Default Image Provider"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Supports(IHasImages item)
|
|
||||||
{
|
|
||||||
return item is ICollectionFolder || item is UserView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return _httpClient.GetResponse(new HttpRequestOptions
|
|
||||||
{
|
|
||||||
CancellationToken = cancellationToken,
|
|
||||||
Url = url,
|
|
||||||
ResourcePool = GenreImageProvider.ImageDownloadResourcePool
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
return GetSupportedImages(item).Any(i => !item.HasImage(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Order
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// Run after the dynamic image provider
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -83,7 +83,6 @@
|
|||||||
<Compile Include="BoxSets\MovieDbBoxSetProvider.cs" />
|
<Compile Include="BoxSets\MovieDbBoxSetProvider.cs" />
|
||||||
<Compile Include="Channels\ChannelMetadataService.cs" />
|
<Compile Include="Channels\ChannelMetadataService.cs" />
|
||||||
<Compile Include="Chapters\ChapterManager.cs" />
|
<Compile Include="Chapters\ChapterManager.cs" />
|
||||||
<Compile Include="FolderImages\DefaultImageProvider.cs" />
|
|
||||||
<Compile Include="Folders\FolderMetadataService.cs" />
|
<Compile Include="Folders\FolderMetadataService.cs" />
|
||||||
<Compile Include="Channels\AudioChannelItemMetadataService.cs" />
|
<Compile Include="Channels\AudioChannelItemMetadataService.cs" />
|
||||||
<Compile Include="Folders\UserViewMetadataService.cs" />
|
<Compile Include="Folders\UserViewMetadataService.cs" />
|
||||||
|
@ -1678,11 +1678,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(viewType))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("viewType");
|
|
||||||
}
|
|
||||||
|
|
||||||
var id = GetNewItemId("37_namedview_" + name + user.Id.ToString("N") + (parentId ?? string.Empty), typeof(UserView));
|
var id = GetNewItemId("37_namedview_" + name + user.Id.ToString("N") + (parentId ?? string.Empty), typeof(UserView));
|
||||||
|
|
||||||
var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N"));
|
var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N"));
|
||||||
@ -1716,6 +1711,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.Equals(viewType, item.ViewType, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ViewType = viewType;
|
||||||
|
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 12;
|
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 12;
|
||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
|
@ -53,6 +53,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var excludeFolderIds = user.Configuration.ExcludeFoldersFromGrouping.Select(i => new Guid(i)).ToList();
|
var excludeFolderIds = user.Configuration.ExcludeFoldersFromGrouping.Select(i => new Guid(i)).ToList();
|
||||||
|
var plainFolderIds = user.Configuration.PlainFolderViews.Select(i => new Guid(i)).ToList();
|
||||||
|
|
||||||
var standaloneFolders = folders
|
var standaloneFolders = folders
|
||||||
.Where(i => UserView.IsExcludedFromGrouping(i) || excludeFolderIds.Contains(i.Id))
|
.Where(i => UserView.IsExcludedFromGrouping(i) || excludeFolderIds.Contains(i.Id))
|
||||||
@ -72,13 +73,17 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
var collectionFolder = folder as ICollectionFolder;
|
var collectionFolder = folder as ICollectionFolder;
|
||||||
var folderViewType = collectionFolder == null ? null : collectionFolder.CollectionType;
|
var folderViewType = collectionFolder == null ? null : collectionFolder.CollectionType;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(folderViewType))
|
if (plainFolderIds.Contains(folder.Id))
|
||||||
{
|
{
|
||||||
list.Add(folder);
|
list.Add(await GetUserView(folder.Id, folder.Name, folderViewType, false, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrWhiteSpace(folderViewType))
|
||||||
|
{
|
||||||
|
list.Add(await GetUserView(folder.Id, folder.Name, folderViewType, true, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(folder.Id, folder.Name, folderViewType, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
list.Add(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,44 +92,57 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
list.AddRange(standaloneFolders);
|
list.AddRange(standaloneFolders);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) ||
|
var parents = foldersWithViewTypes.Where(i => string.Equals(i.CollectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.CollectionType))
|
||||||
foldersWithViewTypes.Any(i => string.IsNullOrWhiteSpace(i.CollectionType)))
|
.ToList();
|
||||||
|
|
||||||
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(CollectionType.TvShows, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(parents, CollectionType.TvShows, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase)) ||
|
parents = foldersWithViewTypes.Where(i => string.Equals(i.CollectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase) || string.Equals(i.CollectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.CollectionType))
|
||||||
foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)))
|
.ToList();
|
||||||
|
|
||||||
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(CollectionType.Music, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(parents, CollectionType.Music, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase)) ||
|
parents = foldersWithViewTypes.Where(i => string.Equals(i.CollectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.CollectionType))
|
||||||
foldersWithViewTypes.Any(i => string.IsNullOrWhiteSpace(i.CollectionType)))
|
.ToList();
|
||||||
|
|
||||||
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(CollectionType.Movies, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(parents, CollectionType.Movies, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase)))
|
parents = foldersWithViewTypes.Where(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(CollectionType.Games, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(parents, CollectionType.Games, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)))
|
parents = foldersWithViewTypes.Where(i => string.Equals(i.CollectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
//list.Add(_collectionManager.GetCollectionsFolder(user.Id.ToString("N")));
|
list.Add(await GetUserView(parents, CollectionType.BoxSets, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
list.Add(await GetUserView(CollectionType.BoxSets, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase)))
|
parents = foldersWithViewTypes.Where(i => string.Equals(i.CollectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
//list.Add(_playlists.GetPlaylistsFolder(user.Id.ToString("N")));
|
list.Add(await GetUserView(parents, CollectionType.Playlists, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
list.Add(await GetUserView(CollectionType.Playlists, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.Configuration.DisplayFoldersView)
|
if (user.Configuration.DisplayFoldersView)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(CollectionType.Folders, "zz_" + CollectionType.Folders, user, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(new List<ICollectionFolder>(), CollectionType.Folders, "zz_" + CollectionType.Folders, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.IncludeExternalContent)
|
if (query.IncludeExternalContent)
|
||||||
@ -151,7 +169,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId))
|
if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId))
|
||||||
{
|
{
|
||||||
//list.Add(await _liveTvManager.GetInternalLiveTvFolder(query.UserId, cancellationToken).ConfigureAwait(false));
|
//list.Add(await _liveTvManager.GetInternalLiveTvFolder(query.UserId, cancellationToken).ConfigureAwait(false));
|
||||||
list.Add(await GetUserView(CollectionType.LiveTv, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(new List<ICollectionFolder>(), CollectionType.LiveTv, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,16 +200,46 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return GetUserSubView(name, parentId, type, user, sortName, cancellationToken);
|
return GetUserSubView(name, parentId, type, user, sortName, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<UserView> GetUserView(string type, string sortName, User user, CancellationToken cancellationToken)
|
public async Task<UserView> GetUserView(List<ICollectionFolder> parents, string viewType, string sortName, User user, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var name = _localizationManager.GetLocalizedString("ViewType" + type);
|
if (parents.Count == 1 && parents.All(i => string.Equals(i.CollectionType, viewType, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
var name = parents[0].Name;
|
||||||
|
var parentId = parents[0].Id;
|
||||||
|
|
||||||
return _libraryManager.GetNamedView(user, name, type, sortName, cancellationToken);
|
var enableRichView = !user.Configuration.PlainFolderViews.Contains(parentId.ToString("N"), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
if (_config.Configuration.EnableUserSpecificUserViews2)
|
||||||
|
{
|
||||||
|
return await GetUserView(parentId, name, viewType, enableRichView, string.Empty, user, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_config.Configuration.EnableUserSpecificUserViews)
|
||||||
|
{
|
||||||
|
viewType = enableRichView ? viewType : null;
|
||||||
|
var view = await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (view.ParentId != parentId)
|
||||||
|
{
|
||||||
|
view.ParentId = parentId;
|
||||||
|
await view.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var name = _localizationManager.GetLocalizedString("ViewType" + viewType);
|
||||||
|
|
||||||
|
return await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<UserView> GetUserView(Guid parentId, string name, string type, string sortName, User user, CancellationToken cancellationToken)
|
public Task<UserView> GetUserView(Guid parentId, string name, string viewType, bool enableRichView, string sortName, User user, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _libraryManager.GetNamedView(user, name, parentId.ToString("N"), type, sortName, cancellationToken);
|
return _libraryManager.GetNamedView(user, name, parentId.ToString("N"), viewType, sortName, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tuple<BaseItem, List<BaseItem>>> GetLatestItems(LatestItemsQuery request)
|
public List<Tuple<BaseItem, List<BaseItem>>> GetLatestItems(LatestItemsQuery request)
|
||||||
@ -317,7 +365,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
.RootFolder
|
.RootFolder
|
||||||
.GetRecursiveChildren(filter);
|
.GetRecursiveChildren(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<BaseItem> GetItemsConfiguredForLatest(User user, Func<BaseItem, bool> filter)
|
private IEnumerable<BaseItem> GetItemsConfiguredForLatest(User user, Func<BaseItem, bool> filter)
|
||||||
{
|
{
|
||||||
// Avoid implicitly captured closure
|
// Avoid implicitly captured closure
|
||||||
|
@ -1430,5 +1430,8 @@
|
|||||||
"ButtonMyPreferencesWelcomeNo": "No thanks, I'll do it later.",
|
"ButtonMyPreferencesWelcomeNo": "No thanks, I'll do it later.",
|
||||||
"MyPreferencesWelcomeMessage1": "We've presented your library in a way we think you'll enjoy. The appearance and grouping of content can be changed anytime by adjusting your preferences. Your preferences will apply to all Emby apps.",
|
"MyPreferencesWelcomeMessage1": "We've presented your library in a way we think you'll enjoy. The appearance and grouping of content can be changed anytime by adjusting your preferences. Your preferences will apply to all Emby apps.",
|
||||||
"MyPreferencesWelcomeMessage2": "Would you like to set your preferences now?",
|
"MyPreferencesWelcomeMessage2": "Would you like to set your preferences now?",
|
||||||
"ToAccessPreferencesHelp": "To access your preferences later, click your user icon in the top right header and select My Preferences."
|
"ToAccessPreferencesHelp": "To access your preferences later, click your user icon in the top right header and select My Preferences.",
|
||||||
|
"HeaderViewStyles": "View Styles",
|
||||||
|
"LabelSelectViewStyles": "Enable rich presentations for:",
|
||||||
|
"LabelSelectViewStylesHelp": "If enabled, views will be built with metadata to offer categories such as Suggestions, Latest, Genres, and more. If disabled, they'll be displayed with plain folders."
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
{
|
{
|
||||||
Condition = ProfileConditionType.LessThanEqual,
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
Property = ProfileConditionValue.AudioChannels,
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
Value = "5",
|
Value = "6",
|
||||||
IsRequired = false
|
IsRequired = false
|
||||||
},
|
},
|
||||||
new ProfileCondition
|
new ProfileCondition
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
//[assembly: AssemblyVersion("3.0.*")]
|
[assembly: AssemblyVersion("3.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.5582.1")]
|
//[assembly: AssemblyVersion("3.0.5582.1")]
|
||||||
|
Loading…
Reference in New Issue
Block a user