stop guide refresh when needed
This commit is contained in:
parent
de9cd28a79
commit
3674a65fae
|
@ -389,6 +389,8 @@ namespace Emby.Server.Implementations.Data
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
GC.Collect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -855,7 +855,7 @@ namespace Emby.Server.Implementations.Library
|
|||
SortOrder = SortOrder.Descending,
|
||||
Limit = 1
|
||||
};
|
||||
|
||||
|
||||
return GetItemList(query)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
@ -1113,16 +1113,21 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
progress.Report(1);
|
||||
|
||||
var userRoot = GetUserRootFolder();
|
||||
await GetUserRootFolder().RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await userRoot.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await userRoot.ValidateChildren(new Progress<double>(), cancellationToken, new MetadataRefreshOptions(_fileSystem), recursive: false).ConfigureAwait(false);
|
||||
await GetUserRootFolder().ValidateChildren(new Progress<double>(), cancellationToken, new MetadataRefreshOptions(_fileSystem), recursive: false).ConfigureAwait(false);
|
||||
progress.Report(2);
|
||||
|
||||
// Quickly scan CollectionFolders for changes
|
||||
foreach (var folder in GetUserRootFolder().Children.OfType<Folder>().ToList())
|
||||
{
|
||||
await folder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
progress.Report(3);
|
||||
|
||||
var innerProgress = new ActionableProgress<double>();
|
||||
|
||||
innerProgress.RegisterAction(pct => progress.Report(2 + pct * .73));
|
||||
innerProgress.RegisterAction(pct => progress.Report(3 + pct * .72));
|
||||
|
||||
// Now validate the entire media library
|
||||
await RootFolder.ValidateChildren(innerProgress, cancellationToken, new MetadataRefreshOptions(_fileSystem), recursive: true).ConfigureAwait(false);
|
||||
|
@ -1291,7 +1296,6 @@ namespace Emby.Server.Implementations.Library
|
|||
if (parent != null)
|
||||
{
|
||||
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
|
||||
query.ParentId = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1315,6 @@ namespace Emby.Server.Implementations.Library
|
|||
if (parent != null)
|
||||
{
|
||||
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
|
||||
query.ParentId = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1456,6 +1459,12 @@ namespace Emby.Server.Implementations.Library
|
|||
// Optimize by querying against top level views
|
||||
query.TopParentIds = parents.SelectMany(i => GetTopParentIdsForQuery(i, query.User)).Select(i => i.ToString("N")).ToArray();
|
||||
query.AncestorIds = new string[] { };
|
||||
|
||||
// Prevent searching in all libraries due to empty filter
|
||||
if (query.TopParentIds.Length == 0)
|
||||
{
|
||||
query.TopParentIds = new[] { Guid.NewGuid().ToString("N") };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1478,7 +1487,6 @@ namespace Emby.Server.Implementations.Library
|
|||
if (parent != null)
|
||||
{
|
||||
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
|
||||
query.ParentId = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1514,12 +1522,26 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
// Optimize by querying against top level views
|
||||
query.TopParentIds = parents.SelectMany(i => GetTopParentIdsForQuery(i, query.User)).Select(i => i.ToString("N")).ToArray();
|
||||
|
||||
// Prevent searching in all libraries due to empty filter
|
||||
if (query.TopParentIds.Length == 0)
|
||||
{
|
||||
query.TopParentIds = new[] { Guid.NewGuid().ToString("N") };
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We need to be able to query from any arbitrary ancestor up the tree
|
||||
query.AncestorIds = parents.SelectMany(i => i.GetIdsForAncestorQuery()).Select(i => i.ToString("N")).ToArray();
|
||||
|
||||
// Prevent searching in all libraries due to empty filter
|
||||
if (query.AncestorIds.Length == 0)
|
||||
{
|
||||
query.AncestorIds = new[] { Guid.NewGuid().ToString("N") };
|
||||
}
|
||||
}
|
||||
|
||||
query.ParentId = null;
|
||||
}
|
||||
|
||||
private void AddUserToQuery(InternalItemsQuery query, User user)
|
||||
|
@ -1561,7 +1583,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
}, CancellationToken.None).Result;
|
||||
|
||||
return channelResult.Items.Select(i => i.Id);
|
||||
return channelResult.Items.Select(i => i.Id);
|
||||
}
|
||||
|
||||
// Translate view into folders
|
||||
|
@ -1602,7 +1624,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
return collectionFolder.PhysicalFolderIds;
|
||||
}
|
||||
|
||||
|
||||
var topParent = item.GetTopParent();
|
||||
if (topParent != null)
|
||||
{
|
||||
|
|
|
@ -144,23 +144,16 @@ namespace Emby.Server.Implementations.TV
|
|||
// If viewing all next up for all series, remove first episodes
|
||||
// But if that returns empty, keep those first episodes (avoid completely empty view)
|
||||
var alwaysEnableFirstEpisode = !string.IsNullOrWhiteSpace(request.SeriesId);
|
||||
var isFirstItemAFirstEpisode = true;
|
||||
|
||||
return allNextUp
|
||||
.Where(i =>
|
||||
{
|
||||
if (alwaysEnableFirstEpisode || i.Item1 != DateTime.MinValue)
|
||||
{
|
||||
isFirstItemAFirstEpisode = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isFirstItemAFirstEpisode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
})
|
||||
.Select(i => i.Item2())
|
||||
.Where(i => i != null)
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace MediaBrowser.Api
|
|||
options.Fields.Add(Model.Querying.ItemFields.ChildCount);
|
||||
}
|
||||
|
||||
if (client.IndexOf("web", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
else if (client.IndexOf("web", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
|
||||
// covers both emby mobile and emby for android mobile
|
||||
client.IndexOf("mobile", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
|
|
|
@ -201,6 +201,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
|
||||
protected override bool RefreshLinkedChildren(IEnumerable<FileSystemMetadata> fileSystemChildren)
|
||||
{
|
||||
return RefreshLinkedChildrenInternal(true);
|
||||
}
|
||||
|
||||
private bool RefreshLinkedChildrenInternal(bool setFolders)
|
||||
{
|
||||
var physicalFolders = GetPhysicalFolders(false)
|
||||
.ToList();
|
||||
|
@ -219,7 +224,10 @@ namespace MediaBrowser.Controller.Entities
|
|||
if (!folderIds.SequenceEqual(newFolderIds))
|
||||
{
|
||||
changed = true;
|
||||
PhysicalFolderIds = newFolderIds.ToList();
|
||||
if (setFolders)
|
||||
{
|
||||
PhysicalFolderIds = newFolderIds.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
|
Loading…
Reference in New Issue
Block a user