mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	cleanup content overrides when adding library paths
This commit is contained in:
		
							parent
							
								
									ff3f6661ec
								
							
						
					
					
						commit
						35e83dc73d
					
				@ -70,11 +70,7 @@ namespace MediaBrowser.Api
 | 
			
		||||
                Cultures = _localizationManager.GetCultures().ToList()
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            var locationType = item.LocationType;
 | 
			
		||||
            if (locationType == LocationType.FileSystem ||
 | 
			
		||||
                locationType == LocationType.Offline)
 | 
			
		||||
            {
 | 
			
		||||
                if (!(item is ICollectionFolder) && !(item is UserView) && !(item is AggregateFolder) && !(item is LiveTvChannel) && !(item is IItemByName))
 | 
			
		||||
            if (!item.IsVirtualItem && !(item is ICollectionFolder) && !(item is UserView) && !(item is AggregateFolder) && !(item is LiveTvChannel) && !(item is IItemByName))
 | 
			
		||||
            {
 | 
			
		||||
                var inheritedContentType = _libraryManager.GetInheritedContentType(item);
 | 
			
		||||
                var configuredContentType = _libraryManager.GetConfiguredContentType(item);
 | 
			
		||||
@ -92,7 +88,6 @@ namespace MediaBrowser.Api
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return ToOptimizedResult(info);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -2791,6 +2791,31 @@ namespace MediaBrowser.Server.Implementations.Library
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            _fileSystem.CreateShortcut(lnk, path);
 | 
			
		||||
 | 
			
		||||
            RemoveContentTypeOverrides(path);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void RemoveContentTypeOverrides(string path)
 | 
			
		||||
        {
 | 
			
		||||
            var removeList = new List<NameValuePair>();
 | 
			
		||||
 | 
			
		||||
            foreach (var contentType in ConfigurationManager.Configuration.ContentTypes)
 | 
			
		||||
            {
 | 
			
		||||
                if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
 | 
			
		||||
                    || _fileSystem.ContainsSubPath(path, contentType.Name))
 | 
			
		||||
                {
 | 
			
		||||
                    removeList.Add(contentType);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (removeList.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                ConfigurationManager.Configuration.ContentTypes = ConfigurationManager.Configuration.ContentTypes
 | 
			
		||||
                    .Except(removeList)
 | 
			
		||||
                        .ToArray();
 | 
			
		||||
 | 
			
		||||
                ConfigurationManager.SaveConfiguration();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void RemoveMediaPath(string virtualFolderName, string mediaPath)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user