cleanup content overrides when adding library paths

This commit is contained in:
Luke Pulverenti 2016-06-27 16:33:35 -04:00
parent ff3f6661ec
commit 35e83dc73d
2 changed files with 36 additions and 16 deletions

View File

@ -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);
}

View File

@ -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)