mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-19 11:59:02 -07:00
commit
71ee865689
@ -1101,7 +1101,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||||||
StartIndex = query.StartIndex,
|
StartIndex = query.StartIndex,
|
||||||
UserId = query.User.Id.ToString("N")
|
UserId = query.User.Id.ToString("N")
|
||||||
|
|
||||||
}, new List<Folder> { (Folder)parent }, query.DtoOptions);
|
}, new List<BaseItem> { parent }, query.DtoOptions);
|
||||||
|
|
||||||
return ToResult(result);
|
return ToResult(result);
|
||||||
}
|
}
|
||||||
|
@ -333,13 +333,7 @@ namespace Emby.Server.Implementations.IO
|
|||||||
NotifyFilters.Attributes;
|
NotifyFilters.Attributes;
|
||||||
|
|
||||||
newWatcher.Created += watcher_Changed;
|
newWatcher.Created += watcher_Changed;
|
||||||
|
newWatcher.Deleted += watcher_Changed;
|
||||||
// Seeing mono crashes on background threads we can't catch, testing if this might help
|
|
||||||
if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
|
|
||||||
{
|
|
||||||
newWatcher.Deleted += watcher_Changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
newWatcher.Renamed += watcher_Changed;
|
newWatcher.Renamed += watcher_Changed;
|
||||||
newWatcher.Changed += watcher_Changed;
|
newWatcher.Changed += watcher_Changed;
|
||||||
|
|
||||||
|
@ -56,37 +56,15 @@ namespace Emby.Server.Implementations.TV
|
|||||||
return GetResult(GetNextUpEpisodes(request, user, new[] { presentationUniqueKey }, dtoOptions), request);
|
return GetResult(GetNextUpEpisodes(request, user, new[] { presentationUniqueKey }, dtoOptions), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit.HasValue)
|
var parents = user.RootFolder.GetChildren(user, true)
|
||||||
{
|
.Where(i => i is Folder)
|
||||||
limit = limit.Value + 10;
|
.Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N")))
|
||||||
}
|
.ToList();
|
||||||
|
|
||||||
var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
return GetNextUp(request, parents, dtoOptions);
|
||||||
{
|
|
||||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
|
||||||
OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) },
|
|
||||||
SeriesPresentationUniqueKey = presentationUniqueKey,
|
|
||||||
Limit = limit,
|
|
||||||
ParentId = parentIdGuid,
|
|
||||||
Recursive = true,
|
|
||||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
|
||||||
{
|
|
||||||
Fields = new ItemFields[]
|
|
||||||
{
|
|
||||||
ItemFields.SeriesPresentationUniqueKey
|
|
||||||
}
|
|
||||||
},
|
|
||||||
GroupBySeriesPresentationUniqueKey = true
|
|
||||||
|
|
||||||
}).Cast<Episode>().Select(GetUniqueSeriesKey);
|
|
||||||
|
|
||||||
// Avoid implicitly captured closure
|
|
||||||
var episodes = GetNextUpEpisodes(request, user, items, dtoOptions);
|
|
||||||
|
|
||||||
return GetResult(episodes, request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult<BaseItem> GetNextUp(NextUpQuery request, List<Folder> parentsFolders, DtoOptions dtoOptions)
|
public QueryResult<BaseItem> GetNextUp(NextUpQuery request, List<BaseItem> parentsFolders, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
@ -134,7 +112,7 @@ namespace Emby.Server.Implementations.TV
|
|||||||
},
|
},
|
||||||
GroupBySeriesPresentationUniqueKey = true
|
GroupBySeriesPresentationUniqueKey = true
|
||||||
|
|
||||||
}, parentsFolders.Cast<BaseItem>().ToList()).Cast<Episode>().Select(GetUniqueSeriesKey);
|
}, parentsFolders).Cast<Episode>().Select(GetUniqueSeriesKey);
|
||||||
|
|
||||||
// Avoid implicitly captured closure
|
// Avoid implicitly captured closure
|
||||||
var episodes = GetNextUpEpisodes(request, user, items, dtoOptions);
|
var episodes = GetNextUpEpisodes(request, user, items, dtoOptions);
|
||||||
|
@ -26,6 +26,11 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("/Users/{UserId}/Items/Resume", "GET", Summary = "Gets items based on a query.")]
|
||||||
|
public class GetResumeItems : BaseItemsRequest, IReturn<QueryResult<BaseItemDto>>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ItemsService
|
/// Class ItemsService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -79,6 +84,53 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
_authContext = authContext;
|
_authContext = authContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object Get(GetResumeItems request)
|
||||||
|
{
|
||||||
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
|
var parentIdGuid = string.IsNullOrWhiteSpace(request.ParentId) ? (Guid?)null : new Guid(request.ParentId);
|
||||||
|
|
||||||
|
var options = GetDtoOptions(_authContext, request);
|
||||||
|
|
||||||
|
var ancestorIds = new List<string>();
|
||||||
|
|
||||||
|
var excludeFolderIds = user.Configuration.LatestItemsExcludes;
|
||||||
|
if (!parentIdGuid.HasValue && excludeFolderIds.Length > 0)
|
||||||
|
{
|
||||||
|
ancestorIds = user.RootFolder.GetChildren(user, true)
|
||||||
|
.Where(i => i is Folder)
|
||||||
|
.Where(i => !excludeFolderIds.Contains(i.Id.ToString("N")))
|
||||||
|
.Select(i => i.Id.ToString("N"))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var itemsResult = _libraryManager.GetItemsResult(new InternalItemsQuery(user)
|
||||||
|
{
|
||||||
|
OrderBy = new[] { ItemSortBy.DatePlayed }.Select(i => new Tuple<string, SortOrder>(i, SortOrder.Descending)).ToArray(),
|
||||||
|
IsResumable = true,
|
||||||
|
StartIndex = request.StartIndex,
|
||||||
|
Limit = request.Limit,
|
||||||
|
ParentId = parentIdGuid,
|
||||||
|
Recursive = true,
|
||||||
|
DtoOptions = options,
|
||||||
|
MediaTypes = request.GetMediaTypes(),
|
||||||
|
IsVirtualItem = false,
|
||||||
|
CollapseBoxSetItems = false,
|
||||||
|
EnableTotalRecordCount = request.EnableTotalRecordCount,
|
||||||
|
AncestorIds = ancestorIds.ToArray()
|
||||||
|
});
|
||||||
|
|
||||||
|
var returnItems = _dtoService.GetBaseItemDtos(itemsResult.Items, options, user);
|
||||||
|
|
||||||
|
var result = new QueryResult<BaseItemDto>
|
||||||
|
{
|
||||||
|
TotalRecordCount = itemsResult.TotalRecordCount,
|
||||||
|
Items = returnItems
|
||||||
|
};
|
||||||
|
|
||||||
|
return ToOptimizedSerializedResultUsingCache(result);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the specified request.
|
/// Gets the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -238,12 +238,9 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
if (queryParent is UserView)
|
if (queryParent is UserView)
|
||||||
{
|
{
|
||||||
return GetResult(GetMediaFolders(user).SelectMany(i => i.GetChildren(user, true)), queryParent, query);
|
return GetResult(GetMediaFolders(user).OfType<Folder>().SelectMany(i => i.GetChildren(user, true)), queryParent, query);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return GetResult(queryParent.GetChildren(user, true), queryParent, query);
|
|
||||||
}
|
}
|
||||||
|
return GetResult(queryParent.GetChildren(user, true), queryParent, query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1681,7 +1678,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<Folder> GetMediaFolders(User user)
|
private IEnumerable<BaseItem> GetMediaFolders(User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
@ -1696,7 +1693,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
.Where(i => user.IsFolderGrouped(i.Id) && UserView.IsEligibleForGrouping(i));
|
.Where(i => user.IsFolderGrouped(i.Id) && UserView.IsEligibleForGrouping(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Folder> GetMediaFolders(User user, IEnumerable<string> viewTypes)
|
private List<BaseItem> GetMediaFolders(User user, IEnumerable<string> viewTypes)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
@ -1717,14 +1714,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Folder> GetMediaFolders(Folder parent, User user, IEnumerable<string> viewTypes)
|
private List<BaseItem> GetMediaFolders(Folder parent, User user, IEnumerable<string> viewTypes)
|
||||||
{
|
{
|
||||||
if (parent == null || parent is UserView)
|
if (parent == null || parent is UserView)
|
||||||
{
|
{
|
||||||
return GetMediaFolders(user, viewTypes);
|
return GetMediaFolders(user, viewTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<Folder> { parent };
|
return new List<BaseItem> { parent };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<QueryResult<BaseItem>> GetLiveTvView(Folder queryParent, User user, InternalItemsQuery query)
|
private async Task<QueryResult<BaseItem>> GetLiveTvView(Folder queryParent, User user, InternalItemsQuery query)
|
||||||
|
@ -15,6 +15,6 @@ namespace MediaBrowser.Controller.TV
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the next up.
|
/// Gets the next up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
QueryResult<BaseItem> GetNextUp(NextUpQuery request, List<Folder> parentsFolders, DtoOptions options);
|
QueryResult<BaseItem> GetNextUp(NextUpQuery request, List<BaseItem> parentsFolders, DtoOptions options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,9 +204,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
|
|
||||||
private bool HasImage(IHasMetadata item, ImageType type)
|
private bool HasImage(IHasMetadata item, ImageType type)
|
||||||
{
|
{
|
||||||
var image = item.GetImageInfo(type, 0);
|
return item.HasImage(type);
|
||||||
|
|
||||||
return image != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.32.14")]
|
[assembly: AssemblyVersion("3.2.32.15")]
|
||||||
|
Loading…
Reference in New Issue
Block a user