Pārlūkot izejas kodu

Replace library option to AutomaticallyAddToCollection

Signed-off-by: Petrus.Z <silencly07@gmail.com>
Petrus.Z 3 gadi atpakaļ
vecāks
revīzija
acb86066ff

+ 14 - 8
Emby.Server.Implementations/Library/Validators/CollectionPostScanTask.cs

@@ -47,18 +47,11 @@ namespace Emby.Server.Implementations.Library.Validators
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
         {
         {
-            var boxSets = _libraryManager.GetItemList(new InternalItemsQuery
-            {
-                IncludeItemTypes = new[] { nameof(BoxSet) },
-                CollapseBoxSetItems = false,
-                Recursive = true
-            });
-
             var collectionNameMoviesMap = new Dictionary<string, HashSet<Guid>>();
             var collectionNameMoviesMap = new Dictionary<string, HashSet<Guid>>();
 
 
             foreach (var library in _libraryManager.RootFolder.Children)
             foreach (var library in _libraryManager.RootFolder.Children)
             {
             {
-                if (!_libraryManager.GetLibraryOptions(library).AutoCollection)
+                if (!_libraryManager.GetLibraryOptions(library).AutomaticallyAddToCollection)
                 {
                 {
                     continue;
                     continue;
                 }
                 }
@@ -107,6 +100,19 @@ namespace Emby.Server.Implementations.Library.Validators
             var numComplete = 0;
             var numComplete = 0;
             var count = collectionNameMoviesMap.Count;
             var count = collectionNameMoviesMap.Count;
 
 
+            if (count == 0)
+            {
+                progress.Report(100);
+                return;
+            }
+
+            var boxSets = _libraryManager.GetItemList(new InternalItemsQuery
+            {
+                IncludeItemTypes = new[] { nameof(BoxSet) },
+                CollapseBoxSetItems = false,
+                Recursive = true
+            });
+
             foreach (var (collectionName, movieIds) in collectionNameMoviesMap)
             foreach (var (collectionName, movieIds) in collectionNameMoviesMap)
             {
             {
                 try
                 try

+ 2 - 2
MediaBrowser.Model/Configuration/LibraryOptions.cs

@@ -16,7 +16,7 @@ namespace MediaBrowser.Model.Configuration
             SkipSubtitlesIfAudioTrackMatches = true;
             SkipSubtitlesIfAudioTrackMatches = true;
             RequirePerfectSubtitleMatch = true;
             RequirePerfectSubtitleMatch = true;
 
 
-            AutoCollection = true;
+            AutomaticallyAddToCollection = true;
             EnablePhotos = true;
             EnablePhotos = true;
             SaveSubtitlesWithMedia = true;
             SaveSubtitlesWithMedia = true;
             EnableRealtimeMonitor = true;
             EnableRealtimeMonitor = true;
@@ -81,7 +81,7 @@ namespace MediaBrowser.Model.Configuration
         public bool RequirePerfectSubtitleMatch { get; set; }
         public bool RequirePerfectSubtitleMatch { get; set; }
 
 
         public bool SaveSubtitlesWithMedia { get; set; }
         public bool SaveSubtitlesWithMedia { get; set; }
-        public bool AutoCollection { get; set; }
+        public bool AutomaticallyAddToCollection { get; set; }
 
 
         public TypeOptions[] TypeOptions { get; set; }
         public TypeOptions[] TypeOptions { get; set; }