mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	default recursive to true when validating children
This commit is contained in:
		
							parent
							
								
									38d88aed58
								
							
						
					
					
						commit
						8b29e67e22
					
				@ -570,7 +570,9 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return audio;
 | 
					                return audio;
 | 
				
			||||||
            }).ToList();
 | 
					
 | 
				
			||||||
 | 
					                // Sort them so that the list can be easily compared for changes
 | 
				
			||||||
 | 
					            }).OrderBy(i => i.Path).ToList();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
@ -594,7 +596,9 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return item;
 | 
					                return item;
 | 
				
			||||||
            }).ToList();
 | 
					
 | 
				
			||||||
 | 
					                // Sort them so that the list can be easily compared for changes
 | 
				
			||||||
 | 
					            }).OrderBy(i => i.Path).ToList();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Task RefreshMetadata(CancellationToken cancellationToken)
 | 
					        public Task RefreshMetadata(CancellationToken cancellationToken)
 | 
				
			||||||
@ -652,8 +656,19 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if (themeSongsChanged || themeVideosChanged || localTrailersChanged)
 | 
					            if (themeSongsChanged)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                Logger.Debug("Theme songs have changed for {0}", Path);
 | 
				
			||||||
 | 
					                options.ForceSave = true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (themeVideosChanged)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Logger.Debug("Theme videos have changed for {0}", Path);
 | 
				
			||||||
 | 
					                options.ForceSave = true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (localTrailersChanged)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Logger.Debug("Local trailers have changed for {0}", Path);
 | 
				
			||||||
                options.ForceSave = true;
 | 
					                options.ForceSave = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -684,6 +699,7 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
        private async Task<bool> RefreshThemeVideos(IHasThemeMedia item, MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
 | 
					        private async Task<bool> RefreshThemeVideos(IHasThemeMedia item, MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var newThemeVideos = LoadThemeVideos(fileSystemChildren).ToList();
 | 
					            var newThemeVideos = LoadThemeVideos(fileSystemChildren).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var newThemeVideoIds = newThemeVideos.Select(i => i.Id).ToList();
 | 
					            var newThemeVideoIds = newThemeVideos.Select(i => i.Id).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var themeVideosChanged = !item.ThemeVideoIds.SequenceEqual(newThemeVideoIds);
 | 
					            var themeVideosChanged = !item.ThemeVideoIds.SequenceEqual(newThemeVideoIds);
 | 
				
			||||||
 | 
				
			|||||||
@ -366,7 +366,7 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            cancellationToken.ThrowIfCancellationRequested();
 | 
					            cancellationToken.ThrowIfCancellationRequested();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var validChildren = new List<Tuple<BaseItem, bool>>();
 | 
					            var validChildren = new List<BaseItem>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
 | 
					            if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -412,11 +412,11 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            currentChild.IsInMixedFolder = child.IsInMixedFolder;
 | 
					                            currentChild.IsInMixedFolder = child.IsInMixedFolder;
 | 
				
			||||||
                            validChildren.Add(new Tuple<BaseItem, bool>(currentChild, true));
 | 
					                            validChildren.Add(currentChild);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            validChildren.Add(new Tuple<BaseItem, bool>(currentChild, false));
 | 
					                            validChildren.Add(currentChild);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        currentChild.IsOffline = false;
 | 
					                        currentChild.IsOffline = false;
 | 
				
			||||||
@ -426,17 +426,15 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
                        //brand new item - needs to be added
 | 
					                        //brand new item - needs to be added
 | 
				
			||||||
                        newItems.Add(child);
 | 
					                        newItems.Add(child);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        validChildren.Add(new Tuple<BaseItem, bool>(child, true));
 | 
					                        validChildren.Add(child);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // If any items were added or removed....
 | 
					                // If any items were added or removed....
 | 
				
			||||||
                if (newItems.Count > 0 || currentChildren.Count != validChildren.Count)
 | 
					                if (newItems.Count > 0 || currentChildren.Count != validChildren.Count)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    var newChildren = validChildren.Select(c => c.Item1).ToList();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    // That's all the new and changed ones - now see if there are any that are missing
 | 
					                    // That's all the new and changed ones - now see if there are any that are missing
 | 
				
			||||||
                    var itemsRemoved = currentChildren.Values.Except(newChildren).ToList();
 | 
					                    var itemsRemoved = currentChildren.Values.Except(validChildren).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var actualRemovals = new List<BaseItem>();
 | 
					                    var actualRemovals = new List<BaseItem>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -446,14 +444,14 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
                            item.LocationType == LocationType.Remote)
 | 
					                            item.LocationType == LocationType.Remote)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            // Don't remove these because there's no way to accurately validate them.
 | 
					                            // Don't remove these because there's no way to accurately validate them.
 | 
				
			||||||
                            validChildren.Add(new Tuple<BaseItem, bool>(item, false));
 | 
					                            validChildren.Add(item);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        else if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path))
 | 
					                        else if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path))
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            item.IsOffline = true;
 | 
					                            item.IsOffline = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            validChildren.Add(new Tuple<BaseItem, bool>(item, false));
 | 
					                            validChildren.Add(item);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
@ -481,7 +479,7 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                validChildren.AddRange(ActualChildren.Select(i => new Tuple<BaseItem, bool>(i, false)));
 | 
					                validChildren.AddRange(ActualChildren);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            progress.Report(10);
 | 
					            progress.Report(10);
 | 
				
			||||||
@ -502,7 +500,7 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
        /// <param name="recursive">if set to <c>true</c> [recursive].</param>
 | 
					        /// <param name="recursive">if set to <c>true</c> [recursive].</param>
 | 
				
			||||||
        /// <param name="forceRefreshMetadata">if set to <c>true</c> [force refresh metadata].</param>
 | 
					        /// <param name="forceRefreshMetadata">if set to <c>true</c> [force refresh metadata].</param>
 | 
				
			||||||
        /// <returns>Task.</returns>
 | 
					        /// <returns>Task.</returns>
 | 
				
			||||||
        private async Task RefreshChildren(IList<Tuple<BaseItem, bool>> children, IProgress<double> progress, CancellationToken cancellationToken, bool? recursive, bool forceRefreshMetadata = false)
 | 
					        private async Task RefreshChildren(IList<BaseItem> children, IProgress<double> progress, CancellationToken cancellationToken, bool? recursive, bool forceRefreshMetadata = false)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var list = children;
 | 
					            var list = children;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -525,17 +523,16 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
            await Task.WhenAll(tasks).ConfigureAwait(false);
 | 
					            await Task.WhenAll(tasks).ConfigureAwait(false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private async Task RefreshChild(Tuple<BaseItem, bool> currentTuple, IProgress<double> progress, Dictionary<Guid, double> percentages, int childCount, CancellationToken cancellationToken, bool? recursive, bool forceRefreshMetadata = false)
 | 
					        private async Task RefreshChild(BaseItem item, IProgress<double> progress, Dictionary<Guid, double> percentages, int childCount, CancellationToken cancellationToken, bool? recursive, bool forceRefreshMetadata = false)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            cancellationToken.ThrowIfCancellationRequested();
 | 
					            cancellationToken.ThrowIfCancellationRequested();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var child = currentTuple.Item1;
 | 
					            var child = item;
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                //refresh it
 | 
					                //refresh it
 | 
				
			||||||
                await child.RefreshMetadata(new MetadataRefreshOptions
 | 
					                await child.RefreshMetadata(new MetadataRefreshOptions
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    ForceSave = currentTuple.Item2,
 | 
					 | 
				
			||||||
                    ReplaceAllMetadata = forceRefreshMetadata
 | 
					                    ReplaceAllMetadata = forceRefreshMetadata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }, cancellationToken).ConfigureAwait(false);
 | 
					                }, cancellationToken).ConfigureAwait(false);
 | 
				
			||||||
@ -546,7 +543,7 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Refresh children if a folder and the item changed or recursive is set to true
 | 
					            // Refresh children if a folder and the item changed or recursive is set to true
 | 
				
			||||||
            var refreshChildren = child.IsFolder && (currentTuple.Item2 || (recursive.HasValue && recursive.Value));
 | 
					            var refreshChildren = child.IsFolder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (refreshChildren)
 | 
					            if (refreshChildren)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
				
			|||||||
@ -157,7 +157,9 @@ namespace MediaBrowser.Controller.Entities.Movies
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return video;
 | 
					                return video;
 | 
				
			||||||
            });
 | 
					
 | 
				
			||||||
 | 
					                // Sort them so that the list can be easily compared for changes
 | 
				
			||||||
 | 
					            }).OrderBy(i => i.Path).ToList();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override bool GetBlockUnratedValue(UserConfiguration config)
 | 
					        protected override bool GetBlockUnratedValue(UserConfiguration config)
 | 
				
			||||||
 | 
				
			|||||||
@ -238,7 +238,8 @@ namespace MediaBrowser.Controller.Entities
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                return video;
 | 
					                return video;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }).ToList();
 | 
					                // Sort them so that the list can be easily compared for changes
 | 
				
			||||||
 | 
					            }).OrderBy(i => i.Path).ToList();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override IEnumerable<string> GetDeletePaths()
 | 
					        public override IEnumerable<string> GetDeletePaths()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user