|
|
|
@ -283,17 +283,17 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
{
|
|
|
|
|
var options = GetMetadataOptions(item);
|
|
|
|
|
|
|
|
|
|
return GetMetadataProvidersInternal<T>(item, options, false);
|
|
|
|
|
return GetMetadataProvidersInternal<T>(item, options, false, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerable<IMetadataProvider<T>> GetMetadataProvidersInternal<T>(IHasMetadata item, MetadataOptions options, bool includeDisabled)
|
|
|
|
|
private IEnumerable<IMetadataProvider<T>> GetMetadataProvidersInternal<T>(IHasMetadata item, MetadataOptions options, bool includeDisabled, bool checkIsOwnedItem)
|
|
|
|
|
where T : IHasMetadata
|
|
|
|
|
{
|
|
|
|
|
// Avoid implicitly captured closure
|
|
|
|
|
var currentOptions = options;
|
|
|
|
|
|
|
|
|
|
return _metadataProviders.OfType<IMetadataProvider<T>>()
|
|
|
|
|
.Where(i => CanRefresh(i, item, currentOptions, includeDisabled))
|
|
|
|
|
.Where(i => CanRefresh(i, item, currentOptions, includeDisabled, checkIsOwnedItem))
|
|
|
|
|
.OrderBy(i => GetConfiguredOrder(i, options))
|
|
|
|
|
.ThenBy(GetDefaultOrder);
|
|
|
|
|
}
|
|
|
|
@ -318,7 +318,7 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
return GetImageProviders(item, options, includeDisabled).OfType<IRemoteImageProvider>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool CanRefresh(IMetadataProvider provider, IHasMetadata item, MetadataOptions options, bool includeDisabled)
|
|
|
|
|
private bool CanRefresh(IMetadataProvider provider, IHasMetadata item, MetadataOptions options, bool includeDisabled, bool checkIsOwnedItem)
|
|
|
|
|
{
|
|
|
|
|
if (!includeDisabled)
|
|
|
|
|
{
|
|
|
|
@ -348,7 +348,7 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If this restriction is ever lifted, movie xml providers will have to be updated to prevent owned items like trailers from reading those files
|
|
|
|
|
if (item.IsOwnedItem)
|
|
|
|
|
if (checkIsOwnedItem && item.IsOwnedItem)
|
|
|
|
|
{
|
|
|
|
|
if (provider is ILocalMetadataProvider || provider is IRemoteMetadataProvider)
|
|
|
|
|
{
|
|
|
|
@ -491,7 +491,8 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
// Give it a dummy path just so that it looks like a file system item
|
|
|
|
|
var dummy = new T()
|
|
|
|
|
{
|
|
|
|
|
Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy")
|
|
|
|
|
Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),
|
|
|
|
|
ParentId = Guid.NewGuid()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dummy.SetParent(new Folder());
|
|
|
|
@ -523,7 +524,7 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
private void AddMetadataPlugins<T>(List<MetadataPlugin> list, T item, MetadataOptions options)
|
|
|
|
|
where T : IHasMetadata
|
|
|
|
|
{
|
|
|
|
|
var providers = GetMetadataProvidersInternal<T>(item, options, true).ToList();
|
|
|
|
|
var providers = GetMetadataProvidersInternal<T>(item, options, true, false).ToList();
|
|
|
|
|
|
|
|
|
|
// Locals
|
|
|
|
|
list.AddRange(providers.Where(i => (i is ILocalMetadataProvider)).Select(i => new MetadataPlugin
|
|
|
|
@ -732,14 +733,15 @@ namespace MediaBrowser.Providers.Manager
|
|
|
|
|
// Give it a dummy path just so that it looks like a file system item
|
|
|
|
|
var dummy = new TItemType
|
|
|
|
|
{
|
|
|
|
|
Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy")
|
|
|
|
|
Path = Path.Combine(_appPaths.InternalMetadataPath, "dummy"),
|
|
|
|
|
ParentId = Guid.NewGuid()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dummy.SetParent(new Folder());
|
|
|
|
|
|
|
|
|
|
var options = GetMetadataOptions(dummy);
|
|
|
|
|
|
|
|
|
|
var providers = GetMetadataProvidersInternal<TItemType>(dummy, options, searchInfo.IncludeDisabledProviders)
|
|
|
|
|
var providers = GetMetadataProvidersInternal<TItemType>(dummy, options, searchInfo.IncludeDisabledProviders, false)
|
|
|
|
|
.OfType<IRemoteSearchProvider<TLookupType>>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(searchInfo.SearchProviderName))
|
|
|
|
|