diff options
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 40dccf9ba..57e42985d 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -353,7 +353,7 @@ namespace Emby.Server.Implementations.Library } else { - if (item is Photo) + if (!(item is Video)) { return; } @@ -461,10 +461,10 @@ namespace Emby.Server.Implementations.Library parent.RemoveChild(item); } - await ItemRepository.DeleteItem(item.Id, CancellationToken.None).ConfigureAwait(false); + ItemRepository.DeleteItem(item.Id, CancellationToken.None); foreach (var child in children) { - await ItemRepository.DeleteItem(child.Id, CancellationToken.None).ConfigureAwait(false); + ItemRepository.DeleteItem(child.Id, CancellationToken.None); } BaseItem removed; @@ -599,18 +599,16 @@ namespace Emby.Server.Implementations.Library // When resolving the root, we need it's grandchildren (children of user views) var flattenFolderDepth = isPhysicalRoot ? 2 : 0; - var fileSystemDictionary = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, _fileSystem, _logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); + var files = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, _fileSystem, _logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); // Need to remove subpaths that may have been resolved from shortcuts // Example: if \\server\movies exists, then strip out \\server\movies\action if (isPhysicalRoot) { - var paths = NormalizeRootPathList(fileSystemDictionary.Values); - - fileSystemDictionary = paths.ToDictionary(i => i.FullName); + files = NormalizeRootPathList(files).ToArray(); } - args.FileSystemDictionary = fileSystemDictionary; + args.FileSystemChildren = files; } // Check to see if we should resolve based on our contents @@ -656,7 +654,7 @@ namespace Emby.Server.Implementations.Library return false; } - public IEnumerable<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths) + public List<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths) { var originalList = paths.ToList(); @@ -999,8 +997,7 @@ namespace Emby.Server.Implementations.Library Path = path }; - var task = CreateItem(item, CancellationToken.None); - Task.WaitAll(task); + CreateItem(item, CancellationToken.None); } return item; @@ -1172,7 +1169,7 @@ namespace Emby.Server.Implementations.Library progress.Report(percent * 100); } - await ItemRepository.UpdateInheritedValues(cancellationToken).ConfigureAwait(false); + ItemRepository.UpdateInheritedValues(cancellationToken); progress.Report(100); } @@ -1208,7 +1205,7 @@ namespace Emby.Server.Implementations.Library .Where(i => string.Equals(ShortcutFileExtension, Path.GetExtension(i), StringComparison.OrdinalIgnoreCase)) .Select(_fileSystem.ResolveShortcut) .OrderBy(i => i) - .ToList(), + .ToArray(), CollectionType = GetCollectionType(dir) }; @@ -1554,7 +1551,7 @@ namespace Emby.Server.Implementations.Library IncludeHidden = true, IncludeExternalContent = allowExternalContent - }, CancellationToken.None).Result.ToList(); + }, CancellationToken.None).Result; query.TopParentIds = userViews.SelectMany(i => GetTopParentIdsForQuery(i, user)).Select(i => i.ToString("N")).ToArray(); } @@ -1814,9 +1811,9 @@ namespace Emby.Server.Implementations.Library /// <param name="item">The item.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - public Task CreateItem(BaseItem item, CancellationToken cancellationToken) + public void CreateItem(BaseItem item, CancellationToken cancellationToken) { - return CreateItems(new[] { item }, cancellationToken); + CreateItems(new[] { item }, cancellationToken); } /// <summary> @@ -1825,11 +1822,11 @@ namespace Emby.Server.Implementations.Library /// <param name="items">The items.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> - public async Task CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken) + public void CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken) { var list = items.ToList(); - await ItemRepository.SaveItems(list, cancellationToken).ConfigureAwait(false); + ItemRepository.SaveItems(list, cancellationToken); foreach (var item in list) { @@ -1872,7 +1869,7 @@ namespace Emby.Server.Implementations.Library var logName = item.LocationType == LocationType.Remote ? item.Name ?? item.Path : item.Path ?? item.Name; _logger.Debug("Saving {0} to database.", logName); - await ItemRepository.SaveItem(item, cancellationToken).ConfigureAwait(false); + ItemRepository.SaveItem(item, cancellationToken); RegisterItem(item); @@ -2069,7 +2066,7 @@ namespace Emby.Server.Implementations.Library private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24); //private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromMinutes(1); - public Task<UserView> GetNamedView(User user, + public UserView GetNamedView(User user, string name, string viewType, string sortName, @@ -2107,7 +2104,7 @@ namespace Emby.Server.Implementations.Library ForcedSortName = sortName }; - await CreateItem(item, cancellationToken).ConfigureAwait(false); + CreateItem(item, cancellationToken); refresh = true; } @@ -2138,7 +2135,7 @@ namespace Emby.Server.Implementations.Library return item; } - public async Task<UserView> GetNamedView(User user, + public UserView GetNamedView(User user, string name, string parentId, string viewType, @@ -2175,7 +2172,7 @@ namespace Emby.Server.Implementations.Library item.DisplayParentId = new Guid(parentId); } - await CreateItem(item, cancellationToken).ConfigureAwait(false); + CreateItem(item, cancellationToken); isNew = true; } @@ -2201,7 +2198,7 @@ namespace Emby.Server.Implementations.Library return item; } - public async Task<UserView> GetShadowView(BaseItem parent, + public UserView GetShadowView(BaseItem parent, string viewType, string sortName, CancellationToken cancellationToken) @@ -2240,7 +2237,7 @@ namespace Emby.Server.Implementations.Library item.DisplayParentId = parentId; - await CreateItem(item, cancellationToken).ConfigureAwait(false); + CreateItem(item, cancellationToken); isNew = true; } @@ -2311,7 +2308,7 @@ namespace Emby.Server.Implementations.Library item.DisplayParentId = new Guid(parentId); } - await CreateItem(item, cancellationToken).ConfigureAwait(false); + CreateItem(item, cancellationToken); isNew = true; } @@ -2825,14 +2822,14 @@ namespace Emby.Server.Implementations.Library return ItemRepository.GetPeopleNames(query); } - public Task UpdatePeople(BaseItem item, List<PersonInfo> people) + public void UpdatePeople(BaseItem item, List<PersonInfo> people) { if (!item.SupportsPeople) { - return Task.FromResult(true); + return; } - return ItemRepository.UpdatePeople(item.Id, people); + ItemRepository.UpdatePeople(item.Id, people); } public async Task<ItemImageInfo> ConvertImageToLocal(IHasMetadata item, ItemImageInfo image, int imageIndex) @@ -3061,7 +3058,7 @@ namespace Emby.Server.Implementations.Library var topLibraryFolders = GetUserRootFolder().Children.ToList(); var info = GetVirtualFolderInfo(virtualFolderPath, topLibraryFolders, null); - if (info.Locations.Count > 0 && info.Locations.Count != options.PathInfos.Length) + if (info.Locations.Length > 0 && info.Locations.Length != options.PathInfos.Length) { var list = options.PathInfos.ToList(); |
