af1152b001
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
78 lines
2.8 KiB
C#
78 lines
2.8 KiB
C#
// <copyright file="BaseItemManager.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace MediaBrowser.Controller.BaseItemManager
|
|
{
|
|
using System;
|
|
using Jellyfin.Extensions;
|
|
using MediaBrowser.Controller.Channels;
|
|
using MediaBrowser.Controller.Configuration;
|
|
using MediaBrowser.Controller.Entities;
|
|
using MediaBrowser.Controller.Library;
|
|
using MediaBrowser.Model.Configuration;
|
|
|
|
/// <inheritdoc />
|
|
public class BaseItemManager : IBaseItemManager
|
|
{
|
|
private readonly IServerConfigurationManager _serverConfigurationManager;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="BaseItemManager"/> class.
|
|
/// </summary>
|
|
/// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
|
public BaseItemManager(IServerConfigurationManager serverConfigurationManager)
|
|
{
|
|
_serverConfigurationManager = serverConfigurationManager;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public bool IsMetadataFetcherEnabled(BaseItem baseItem, TypeOptions? libraryTypeOptions, string name)
|
|
{
|
|
if (baseItem is Channel)
|
|
{
|
|
// Hack alert.
|
|
return true;
|
|
}
|
|
|
|
if (baseItem.SourceType == SourceType.Channel)
|
|
{
|
|
// Hack alert.
|
|
return !baseItem.EnableMediaSourceDisplay;
|
|
}
|
|
|
|
if (libraryTypeOptions is not null)
|
|
{
|
|
return libraryTypeOptions.MetadataFetchers.Contains(name, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
var itemConfig = _serverConfigurationManager.GetMetadataOptionsForType(baseItem.GetType().Name);
|
|
return itemConfig is null || !itemConfig.DisabledMetadataFetchers.Contains(name, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public bool IsImageFetcherEnabled(BaseItem baseItem, TypeOptions? libraryTypeOptions, string name)
|
|
{
|
|
if (baseItem is Channel)
|
|
{
|
|
// Hack alert.
|
|
return true;
|
|
}
|
|
|
|
if (baseItem.SourceType == SourceType.Channel)
|
|
{
|
|
// Hack alert.
|
|
return !baseItem.EnableMediaSourceDisplay;
|
|
}
|
|
|
|
if (libraryTypeOptions is not null)
|
|
{
|
|
return libraryTypeOptions.ImageFetchers.Contains(name, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
var itemConfig = _serverConfigurationManager.GetMetadataOptionsForType(baseItem.GetType().Name);
|
|
return itemConfig is null || !itemConfig.DisabledImageFetchers.Contains(name, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
}
|
|
}
|