mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NzbDrone.Common.Extensions;
|
|
using NzbDrone.Core.Datastore.Events;
|
|
using NzbDrone.Core.Localization;
|
|
using NzbDrone.Core.Organizer;
|
|
|
|
namespace NzbDrone.Core.HealthCheck.Checks
|
|
{
|
|
[CheckOn(typeof(ModelEvent<NamingConfig>))]
|
|
public class NamingConfigCheck : HealthCheckBase, IProvideHealthCheck
|
|
{
|
|
private readonly INamingConfigService _namingConfigService;
|
|
|
|
public NamingConfigCheck(INamingConfigService namingConfigService, ILocalizationService localizationService)
|
|
: base(localizationService)
|
|
{
|
|
_namingConfigService = namingConfigService;
|
|
}
|
|
|
|
public override HealthCheck Check()
|
|
{
|
|
var namingConfig = _namingConfigService.GetConfig();
|
|
|
|
if (namingConfig.MovieFolderFormat.IsNotNullOrWhiteSpace())
|
|
{
|
|
var match = FileNameValidation.DeprecatedMovieFolderTokensRegex.Matches(namingConfig.MovieFolderFormat);
|
|
|
|
if (match.Any())
|
|
{
|
|
return new HealthCheck(
|
|
GetType(),
|
|
HealthCheckResult.Error,
|
|
_localizationService.GetLocalizedString(
|
|
"NamingConfigMovieFolderFormatDeprecatedHealthCheckMessage", new Dictionary<string, object>
|
|
{
|
|
{ "tokens", string.Join(", ", match.Select(c => c.Value).ToArray()) },
|
|
}));
|
|
}
|
|
}
|
|
|
|
return new HealthCheck(GetType());
|
|
}
|
|
}
|
|
}
|