From 59f2463efd39e7e69f62dba7c20c4f8cfc96fe94 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 6 May 2017 01:18:54 -0400 Subject: [PATCH] update nuget --- .../Data/CleanDatabaseScheduledTask.cs | 112 +----------------- .../Data/SqliteItemRepository.cs | 24 ---- MediaBrowser.Api/Reports/ReportsService.cs | 5 - MediaBrowser.Api/UserLibrary/ItemsService.cs | 10 +- .../Entities/InternalItemsQuery.cs | 2 - .../MediaBrowser.Server.Startup.Common.csproj | 4 +- .../packages.config | 2 +- 7 files changed, 13 insertions(+), 146 deletions(-) diff --git a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs index 0096f22843..e259557822 100644 --- a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs +++ b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs @@ -71,10 +71,9 @@ namespace Emby.Server.Implementations.Data double newPercentCommplete = 45 + .55 * p; progress.Report(newPercentCommplete); }); - await CleanDeletedItems(cancellationToken, innerProgress).ConfigureAwait(false); - progress.Report(100); await _itemRepo.UpdateInheritedValues(cancellationToken).ConfigureAwait(false); + progress.Report(100); } private async Task CleanDeadItems(CancellationToken cancellationToken, IProgress progress) @@ -115,115 +114,6 @@ namespace Emby.Server.Implementations.Data progress.Report(100); } - private async Task CleanDeletedItems(CancellationToken cancellationToken, IProgress progress) - { - var result = _itemRepo.GetItemIdsWithPath(new InternalItemsQuery - { - LocationTypes = new[] { LocationType.FileSystem }, - //Limit = limit, - - // These have their own cleanup routines - ExcludeItemTypes = new[] - { - typeof(Person).Name, - typeof(Genre).Name, - typeof(MusicGenre).Name, - typeof(GameGenre).Name, - typeof(Studio).Name, - typeof(Year).Name, - typeof(Channel).Name, - typeof(AggregateFolder).Name, - typeof(CollectionFolder).Name - } - }); - - var numComplete = 0; - var numItems = result.Count; - - var allLibraryPaths = _libraryManager - .GetVirtualFolders() - .SelectMany(i => i.Locations) - .ToList(); - - foreach (var item in result) - { - cancellationToken.ThrowIfCancellationRequested(); - - var path = item.Item2; - - try - { - var isPathInLibrary = false; - - if (allLibraryPaths.Any(i => path.StartsWith(i, StringComparison.Ordinal)) || - allLibraryPaths.Contains(path, StringComparer.Ordinal) || - path.StartsWith(_appPaths.ProgramDataPath, StringComparison.Ordinal)) - { - isPathInLibrary = true; - - if (_fileSystem.FileExists(path) || _fileSystem.DirectoryExists(path)) - { - continue; - } - } - - var libraryItem = _libraryManager.GetItemById(item.Item1); - - if (libraryItem == null) - { - continue; - } - - if (libraryItem.IsTopParent) - { - continue; - } - - var hasDualAccess = libraryItem as IHasDualAccess; - if (hasDualAccess != null && hasDualAccess.IsAccessedByName) - { - continue; - } - - var libraryItemPath = libraryItem.Path; - if (!string.Equals(libraryItemPath, path, StringComparison.OrdinalIgnoreCase)) - { - _logger.Error("CleanDeletedItems aborting delete for item {0}-{1} because paths don't match. {2}---{3}", libraryItem.Id, libraryItem.Name, libraryItem.Path ?? string.Empty, path ?? string.Empty); - continue; - } - - if (Folder.IsPathOffline(path, allLibraryPaths)) - { - continue; - } - - if (isPathInLibrary) - { - _logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItemPath ?? string.Empty); - } - else - { - _logger.Info("Deleting item from database {0} because path is no longer in the server library. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItemPath ?? string.Empty); - } - - await libraryItem.OnFileDeleted().ConfigureAwait(false); - } - catch (OperationCanceledException) - { - throw; - } - catch (Exception ex) - { - _logger.ErrorException("Error in CleanDeletedItems. File {0}", ex, path); - } - - numComplete++; - double percent = numComplete; - percent /= numItems; - progress.Report(percent * 100); - } - } - /// /// Creates the triggers that define when the task will run /// diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 272d79e484..c0f473a9db 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -209,7 +209,6 @@ namespace Emby.Server.Implementations.Data AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames); - AddColumn(db, "TypedBaseItems", "LocationType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsLive", "BIT", existingColumnNames); @@ -555,7 +554,6 @@ namespace Emby.Server.Implementations.Data "DateCreated", "DateModified", "ForcedSortName", - "LocationType", "PreferredMetadataLanguage", "PreferredMetadataCountryCode", "IsHD", @@ -835,7 +833,6 @@ namespace Emby.Server.Implementations.Data saveItemStatement.TryBind("@DateModified", item.DateModified); saveItemStatement.TryBind("@ForcedSortName", item.ForcedSortName); - saveItemStatement.TryBind("@LocationType", item.LocationType.ToString()); saveItemStatement.TryBind("@PreferredMetadataLanguage", item.PreferredMetadataLanguage); saveItemStatement.TryBind("@PreferredMetadataCountryCode", item.PreferredMetadataCountryCode); @@ -4077,27 +4074,6 @@ namespace Emby.Server.Implementations.Data whereClauses.Add("ProductionYear in (" + val + ")"); } - if (query.LocationTypes.Length == 1) - { - if (query.LocationTypes[0] == LocationType.Virtual && _config.Configuration.SchemaVersion >= 90) - { - query.IsVirtualItem = true; - } - else - { - whereClauses.Add("LocationType=@LocationType"); - if (statement != null) - { - statement.TryBind("@LocationType", query.LocationTypes[0].ToString()); - } - } - } - else if (query.LocationTypes.Length > 1) - { - var val = string.Join(",", query.LocationTypes.Select(i => "'" + i + "'").ToArray()); - - whereClauses.Add("LocationType in (" + val + ")"); - } if (query.IsVirtualItem.HasValue) { whereClauses.Add("IsVirtualItem=@IsVirtualItem"); diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index 5e13c16539..9490c301d6 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -300,11 +300,6 @@ namespace MediaBrowser.Api.Reports } } - if (!string.IsNullOrEmpty(request.LocationTypes)) - { - query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); - } - // Min official rating if (!string.IsNullOrWhiteSpace(request.MinOfficialRating)) { diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 5d267d0598..f8580d3288 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -328,7 +328,15 @@ namespace MediaBrowser.Api.UserLibrary if (!string.IsNullOrEmpty(request.LocationTypes)) { - query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray(); + var requestedLocationTypes = + request.LocationTypes.Split(',') + .Select(d => (LocationType) Enum.Parse(typeof (LocationType), d, true)) + .ToList(); + + if (requestedLocationTypes.Count > 0 && requestedLocationTypes.Count < 4) + { + query.IsVirtualItem = requestedLocationTypes.Contains(LocationType.Virtual); + } } // Min official rating diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index fb7748e134..6fffbf09e4 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -129,7 +129,6 @@ namespace MediaBrowser.Controller.Entities public string[] AncestorIds { get; set; } public string[] TopParentIds { get; set; } - public LocationType[] LocationTypes { get; set; } public string[] PresetViews { get; set; } public SourceType[] SourceTypes { get; set; } public SourceType[] ExcludeSourceTypes { get; set; } @@ -229,7 +228,6 @@ namespace MediaBrowser.Controller.Entities TopParentIds = new string[] { }; ExcludeTags = new string[] { }; ExcludeInheritedTags = new string[] { }; - LocationTypes = new LocationType[] { }; PresetViews = new string[] { }; SourceTypes = new SourceType[] { }; ExcludeSourceTypes = new SourceType[] { }; diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 9a6cc2d6e4..5955d4c96c 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -37,8 +37,8 @@ ..\ThirdParty\emby\Emby.Server.Core.dll - - ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll + + ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.2\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll True diff --git a/MediaBrowser.Server.Startup.Common/packages.config b/MediaBrowser.Server.Startup.Common/packages.config index d329f2ccee..4b6266585a 100644 --- a/MediaBrowser.Server.Startup.Common/packages.config +++ b/MediaBrowser.Server.Startup.Common/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file