Upgrade StyleCop.Analyzers to Unstable 1.2.0.556

This commit is contained in:
Bogdan
2025-06-06 13:18:01 +03:00
parent 8eec321a0e
commit bdc3b63df2
110 changed files with 297 additions and 292 deletions
@@ -252,7 +252,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly IIndexerHttpClient _httpClient;
private readonly Logger _logger;
private static Dictionary<string, string> CategoriesMap => new ()
private static Dictionary<string, string> CategoriesMap => new()
{
{ "/anime_tv/full", "14" },
{ "/anime_tv/anime_ongoing", "10" },
@@ -149,7 +149,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly AnimeBytesSettings _settings;
private readonly IndexerCapabilities _capabilities;
private static Regex YearRegex => new (@"\b((?:19|20)\d{2})$", RegexOptions.Compiled);
private static Regex YearRegex => new(@"\b((?:19|20)\d{2})$", RegexOptions.Compiled);
public AnimeBytesRequestGenerator(AnimeBytesSettings settings, IndexerCapabilities capabilities)
{
@@ -290,16 +290,16 @@ namespace NzbDrone.Core.Indexers.Definitions
public class AnimeBytesParser : IParseIndexerResponse
{
private static readonly HashSet<string> ExcludedProperties = new (StringComparer.OrdinalIgnoreCase) { "Freeleech" };
private static readonly HashSet<string> RemuxResolutions = new (StringComparer.OrdinalIgnoreCase) { "1080i", "1080p", "2160p", "4K" };
private static readonly HashSet<string> CommonReleaseGroupsProperties = new (StringComparer.OrdinalIgnoreCase)
private static readonly HashSet<string> ExcludedProperties = new(StringComparer.OrdinalIgnoreCase) { "Freeleech" };
private static readonly HashSet<string> RemuxResolutions = new(StringComparer.OrdinalIgnoreCase) { "1080i", "1080p", "2160p", "4K" };
private static readonly HashSet<string> CommonReleaseGroupsProperties = new(StringComparer.OrdinalIgnoreCase)
{
"Softsubs",
"Hardsubs",
"RAW",
"Translated"
};
private static readonly HashSet<string> ExcludedFileExtensions = new (StringComparer.OrdinalIgnoreCase) { ".mka", ".mds", ".md5", ".nfo", ".sfv", ".ass", ".mks", ".srt", ".ssa", ".sup", ".jpeg", ".jpg", ".png", ".otf", ".ttf" };
private static readonly HashSet<string> ExcludedFileExtensions = new(StringComparer.OrdinalIgnoreCase) { ".mka", ".mds", ".md5", ".nfo", ".sfv", ".ass", ".mks", ".srt", ".ssa", ".sup", ".jpeg", ".jpg", ".png", ".otf", ".ttf" };
private static readonly string[] PropertiesSeparator = { " | ", " / " };
@@ -712,7 +712,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class AnimeBytesSettings : NoAuthTorrentBaseSettings
{
private static readonly AnimeBytesSettingsValidator Validator = new ();
private static readonly AnimeBytesSettingsValidator Validator = new();
public AnimeBytesSettings()
{
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public class AvistazParserBase : IParseIndexerResponse
{
protected virtual string TimezoneOffset => "-04:00"; // Avistaz does not specify a timezone & returns server time
private readonly HashSet<string> _hdResolutions = new () { "1080p", "1080i", "720p" };
private readonly HashSet<string> _hdResolutions = new() { "1080p", "1080i", "720p" };
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
@@ -17,7 +17,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public class AvistazSettings : NoAuthTorrentBaseSettings
{
private static readonly AvistazSettingsValidator Validator = new ();
private static readonly AvistazSettingsValidator Validator = new();
public AvistazSettings()
{
@@ -234,7 +234,7 @@ namespace NzbDrone.Core.Indexers.Definitions
{
private readonly BakaBTSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly List<IndexerCategory> _defaultCategories = new () { NewznabStandardCategory.TVAnime };
private readonly List<IndexerCategory> _defaultCategories = new() { NewznabStandardCategory.TVAnime };
public BakaBTParser(BakaBTSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -360,7 +360,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class BeyondHDSettings : NoAuthTorrentBaseSettings
{
private static readonly BeyondHDSettingsValidator Validator = new ();
private static readonly BeyondHDSettingsValidator Validator = new();
public BeyondHDSettings()
{
@@ -216,7 +216,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public string BaseUrl { get; set; }
[FieldDefinition(2)]
public IndexerBaseSettings BaseSettings { get; set; } = new ();
public IndexerBaseSettings BaseSettings { get; set; } = new();
public NzbDroneValidationResult Validate()
{
@@ -12,7 +12,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
{
public class BroadcastheNetParser : IParseIndexerResponse
{
private static readonly Regex RegexProtocol = new ("^https?:", RegexOptions.Compiled);
private static readonly Regex RegexProtocol = new("^https?:", RegexOptions.Compiled);
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
public class BroadcastheNetSettings : NoAuthTorrentBaseSettings
{
private static readonly BroadcastheNetSettingsValidator Validator = new ();
private static readonly BroadcastheNetSettingsValidator Validator = new();
public BroadcastheNetSettings()
{
@@ -128,8 +128,8 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
{
var defaultSettings = new List<SettingsField>
{
new () { Name = "username", Label = "Username", Type = "text" },
new () { Name = "password", Label = "Password", Type = "password" }
new() { Name = "username", Label = "Username", Type = "text" },
new() { Name = "password", Label = "Password", Type = "password" }
};
var settings = definition.Settings ?? defaultSettings;
@@ -27,8 +27,8 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
protected virtual string SiteLink { get; private set; }
protected readonly IndexerCapabilitiesCategories _categories = new ();
protected readonly List<string> _defaultCategories = new ();
protected readonly IndexerCapabilitiesCategories _categories = new();
protected readonly List<string> _defaultCategories = new();
protected readonly string[] OptionalFields = new string[] { "imdb", "imdbid", "tmdbid", "rageid", "tvdbid", "tvmazeid", "traktid", "doubanid", "poster", "banner", "description", "genre" };
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
public class CardigannSettings : NoAuthTorrentBaseSettings
{
private static readonly CardigannSettingsValidator Validator = new ();
private static readonly CardigannSettingsValidator Validator = new();
public CardigannSettings()
{
@@ -16,7 +16,7 @@ public class FileListSettingsValidator : NoAuthSettingsValidator<FileListSetting
public class FileListSettings : NoAuthTorrentBaseSettings
{
private static readonly FileListSettingsValidator Validator = new ();
private static readonly FileListSettingsValidator Validator = new();
public FileListSettings()
{
@@ -228,7 +228,7 @@ public class FunFileParser : IParseIndexerResponse
private readonly UserPassTorrentBaseSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly List<string> _validTagList = new ()
private readonly List<string> _validTagList = new()
{
"action",
"adventure",
@@ -11,7 +11,7 @@ public class GazelleSettingsValidator<T> : UserPassBaseSettingsValidator<T>
public class GazelleSettings : UserPassTorrentBaseSettings
{
private static readonly GazelleSettingsValidator<GazelleSettings> Validator = new ();
private static readonly GazelleSettingsValidator<GazelleSettings> Validator = new();
public string AuthKey { get; set; }
public string PassKey { get; set; }
@@ -19,7 +19,7 @@ public class GazelleUserPassOrCookieValidator<T> : NoAuthSettingsValidator<T>
public class GazelleUserPassOrCookieSettings : GazelleSettings
{
private static readonly GazelleUserPassOrCookieValidator<GazelleUserPassOrCookieSettings> Validator = new ();
private static readonly GazelleUserPassOrCookieValidator<GazelleUserPassOrCookieSettings> Validator = new();
[FieldDefinition(4, Label = "Cookie", HelpText = "Use the Cookie field only if 2FA is enabled for your account, leave it empty otherwise.", HelpLink = "https://wiki.servarr.com/useful-tools#finding-cookies", Privacy = PrivacyLevel.Password)]
public string Cookie { get; set; }
@@ -369,7 +369,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly GazelleGamesSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private static Regex YearRegex => new (@"\b(?:19|20|21)\d{2}\b", RegexOptions.Compiled);
private static Regex YearRegex => new(@"\b(?:19|20|21)\d{2}\b", RegexOptions.Compiled);
public GazelleGamesParser(GazelleGamesSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -553,7 +553,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class GazelleGamesSettings : NoAuthTorrentBaseSettings
{
private static readonly GazelleGamesSettingsValidator Validator = new ();
private static readonly GazelleGamesSettingsValidator Validator = new();
public GazelleGamesSettings()
{
@@ -120,7 +120,7 @@ public class GreatPosterWallParser : GazelleParser
private readonly GreatPosterWallSettings _settings;
private readonly Logger _logger;
private readonly HashSet<string> _hdResolutions = new () { "1080p", "1080i", "720p" };
private readonly HashSet<string> _hdResolutions = new() { "1080p", "1080i", "720p" };
public GreatPosterWallParser(GreatPosterWallSettings settings, IndexerCapabilities capabilities, Logger logger)
: base(settings, capabilities)
@@ -272,7 +272,7 @@ public class GreatPosterWallParser : GazelleParser
public class GreatPosterWallSettings : GazelleUserPassOrCookieSettings
{
private static readonly GazelleUserPassOrCookieValidator<GreatPosterWallSettings> Validator = new ();
private static readonly GazelleUserPassOrCookieValidator<GreatPosterWallSettings> Validator = new();
[FieldDefinition(6, Label = "Freeleech Only", Type = FieldType.Checkbox, HelpText = "Search freeleech torrents only")]
public bool FreeleechOnly { get; set; }
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
private readonly HDBitsSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly List<int> _halfLeechMediums = new () { (int)HdBitsMedium.Bluray, (int)HdBitsMedium.Remux, (int)HdBitsMedium.Capture };
private readonly List<int> _halfLeechMediums = new() { (int)HdBitsMedium.Bluray, (int)HdBitsMedium.Remux, (int)HdBitsMedium.Capture };
public HDBitsParser(HDBitsSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -18,7 +18,7 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
public class HDBitsSettings : NoAuthTorrentBaseSettings
{
private static readonly HDBitsSettingsValidator Validator = new ();
private static readonly HDBitsSettingsValidator Validator = new();
public HDBitsSettings()
{
@@ -234,8 +234,8 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly UserPassTorrentBaseSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly Regex _posterRegex = new (@"src=\\'./([^']+)\\'", RegexOptions.IgnoreCase);
private readonly HashSet<string> _freeleechRanks = new (StringComparer.OrdinalIgnoreCase)
private readonly Regex _posterRegex = new(@"src=\\'./([^']+)\\'", RegexOptions.IgnoreCase);
private readonly HashSet<string> _freeleechRanks = new(StringComparer.OrdinalIgnoreCase)
{
"VIP",
"Uploader",
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Indexers.Headphones
public class HeadphonesSettings : IIndexerSettings
{
private static readonly HeadphonesSettingsValidator Validator = new ();
private static readonly HeadphonesSettingsValidator Validator = new();
public HeadphonesSettings()
{
@@ -38,7 +38,7 @@ namespace NzbDrone.Core.Indexers.Headphones
public string Password { get; set; }
[FieldDefinition(4)]
public IndexerBaseSettings BaseSettings { get; set; } = new ();
public IndexerBaseSettings BaseSettings { get; set; } = new();
public virtual NzbDroneValidationResult Validate()
{
@@ -424,7 +424,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class IPTorrentsSettings : CookieTorrentBaseSettings
{
private static readonly IPTorrentsValidator Validator = new ();
private static readonly IPTorrentsValidator Validator = new();
[FieldDefinition(3, Label = "IndexerIPTorrentsSettingsCookieUserAgent", Type = FieldType.Textbox, HelpText = "IndexerIPTorrentsSettingsCookieUserAgentHelpText")]
public string UserAgent { get; set; }
@@ -257,7 +257,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly ImmortalSeedSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly Regex _dateAddedRegex = new (@"\d{4}-\d{2}-\d{2} \d{2}:\d{2} [AaPp][Mm]", RegexOptions.Compiled);
private readonly Regex _dateAddedRegex = new(@"\d{4}-\d{2}-\d{2} \d{2}:\d{2} [AaPp][Mm]", RegexOptions.Compiled);
public ImmortalSeedParser(ImmortalSeedSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -247,7 +247,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class KnabenParser : IParseIndexerResponse
{
private static readonly Regex DateTimezoneRegex = new (@"[+-]\d{2}:\d{2}$", RegexOptions.Compiled);
private static readonly Regex DateTimezoneRegex = new(@"[+-]\d{2}:\d{2}$", RegexOptions.Compiled);
private readonly IndexerCapabilitiesCategories _categories;
@@ -226,7 +226,7 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator
public class LibbleParser : IParseIndexerResponse
{
private readonly LibbleSettings _settings;
private static Regex ReleaseYearRegex => new (@"\[(\d{4})\]$", RegexOptions.Compiled);
private static Regex ReleaseYearRegex => new(@"\[(\d{4})\]$", RegexOptions.Compiled);
public LibbleParser(LibbleSettings settings)
{
@@ -427,7 +427,7 @@ public class MTeamTpValidator : NoAuthSettingsValidator<MTeamTpSettings>
public class MTeamTpSettings : NoAuthTorrentBaseSettings
{
private static readonly MTeamTpValidator Validator = new ();
private static readonly MTeamTpValidator Validator = new();
[FieldDefinition(2, Label = "ApiKey", HelpText = "IndexerMTeamTpSettingsApiKeyHelpText", Privacy = PrivacyLevel.ApiKey)]
public string ApiKey { get; set; }
@@ -258,7 +258,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class MyAnonamouseRequestGenerator : IIndexerRequestGenerator
{
private static readonly Regex SanitizeSearchQueryRegex = new ("[^\\w]+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SanitizeSearchQueryRegex = new("[^\\w]+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private readonly MyAnonamouseSettings _settings;
private readonly IndexerCapabilities _capabilities;
@@ -417,7 +417,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly Logger _logger;
private readonly ICached<string> _userClassCache;
private readonly HashSet<string> _vipFreeleechUserClasses = new (StringComparer.OrdinalIgnoreCase)
private readonly HashSet<string> _vipFreeleechUserClasses = new(StringComparer.OrdinalIgnoreCase)
{
"VIP",
"Elite VIP"
@@ -613,7 +613,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class MyAnonamouseSettings : NoAuthTorrentBaseSettings
{
private static readonly MyAnonamouseSettingsValidator Validator = new ();
private static readonly MyAnonamouseSettingsValidator Validator = new();
public MyAnonamouseSettings()
{
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.Indexers.Newznab
public class NewznabSettings : IIndexerSettings
{
private static readonly NewznabSettingsValidator Validator = new ();
private static readonly NewznabSettingsValidator Validator = new();
public NewznabSettings()
{
@@ -74,7 +74,7 @@ namespace NzbDrone.Core.Indexers.Newznab
public string VipExpiration { get; set; }
[FieldDefinition(7)]
public IndexerBaseSettings BaseSettings { get; set; } = new ();
public IndexerBaseSettings BaseSettings { get; set; } = new();
public NewznabCapabilitiesSettings Capabilities { get; set; }
@@ -1111,7 +1111,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly NzbIndexSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private static readonly Regex ParseTitleRegex = new (@"\""(?<title>[^:\/]*?)(?:\.(rar|nfo|mkv|par2|001|nzb|url|zip|r[0-9]{2}))?\""", RegexOptions.Compiled);
private static readonly Regex ParseTitleRegex = new(@"\""(?<title>[^:\/]*?)(?:\.(rar|nfo|mkv|par2|001|nzb|url|zip|r[0-9]{2}))?\""", RegexOptions.Compiled);
public NzbIndexParser(NzbIndexSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -1181,7 +1181,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class NzbIndexSettings : IIndexerSettings
{
private static readonly NzbIndexSettingsValidator Validator = new ();
private static readonly NzbIndexSettingsValidator Validator = new();
public NzbIndexSettings()
{
@@ -1195,7 +1195,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public string ApiKey { get; set; }
[FieldDefinition(3)]
public IndexerBaseSettings BaseSettings { get; set; } = new ();
public IndexerBaseSettings BaseSettings { get; set; } = new();
public NzbDroneValidationResult Validate()
{
@@ -445,7 +445,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class OrpheusSettings : NoAuthTorrentBaseSettings
{
private static readonly OrpheusSettingsValidator Validator = new ();
private static readonly OrpheusSettingsValidator Validator = new();
public OrpheusSettings()
{
@@ -84,7 +84,7 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn
public class PassThePopcornFlag : IndexerFlag
{
public static IndexerFlag Golden => new ("golden", "Release follows Golden Popcorn quality rules");
public static IndexerFlag Approved => new ("approved", "Release approved by PTP staff");
public static IndexerFlag Golden => new("golden", "Release follows Golden Popcorn quality rules");
public static IndexerFlag Approved => new("approved", "Release approved by PTP staff");
}
}
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Indexers.Definitions.PassThePopcorn
public class PassThePopcornSettings : NoAuthTorrentBaseSettings
{
private static readonly PassThePopcornSettingsValidator Validator = new ();
private static readonly PassThePopcornSettingsValidator Validator = new();
public PassThePopcornSettings()
{
@@ -242,7 +242,7 @@ public class PixelHDSettingsValidator : CookieBaseSettingsValidator<PixelHDSetti
public class PixelHDSettings : CookieTorrentBaseSettings
{
private static readonly PixelHDSettingsValidator Validator = new ();
private static readonly PixelHDSettingsValidator Validator = new();
[FieldDefinition(3, Label = "Cookie User-Agent", Type = FieldType.Textbox, HelpText = "User-Agent associated with cookie used from Browser")]
public string UserAgent { get; set; }
@@ -323,7 +323,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly PornoLabSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly Logger _logger;
private static readonly Regex StripRussianRegex = new (@"(\([\p{IsCyrillic}\W]+\))|(^[\p{IsCyrillic}\W\d]+\/ )|([\p{IsCyrillic} \-]+,+)|([\p{IsCyrillic}]+)");
private static readonly Regex StripRussianRegex = new(@"(\([\p{IsCyrillic}\W]+\))|(^[\p{IsCyrillic}\W\d]+\/ )|([\p{IsCyrillic} \-]+,+)|([\p{IsCyrillic}]+)");
public PornoLabParser(PornoLabSettings settings, IndexerCapabilitiesCategories categories, Logger logger)
{
@@ -396,7 +396,7 @@ public class PreToMeSettingsValidator : UserPassBaseSettingsValidator<PreToMeSet
public class PreToMeSettings : UserPassTorrentBaseSettings
{
private static readonly PreToMeSettingsValidator Validator = new ();
private static readonly PreToMeSettingsValidator Validator = new();
[FieldDefinition(4, Label = "Pin", HelpText = "Site Pin", Privacy = PrivacyLevel.Password)]
public string Pin { get; set; }
@@ -12,7 +12,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Rarbg
{
public class RarbgParser : IParseIndexerResponse
{
private static readonly Regex RegexGuid = new (@"^magnet:\?xt=urn:btih:([a-f0-9]+)", RegexOptions.Compiled);
private static readonly Regex RegexGuid = new(@"^magnet:\?xt=urn:btih:([a-f0-9]+)", RegexOptions.Compiled);
private readonly IndexerCapabilities _capabilities;
private readonly Logger _logger;
@@ -456,7 +456,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class RedactedSettings : NoAuthTorrentBaseSettings
{
private static readonly RedactedSettingsValidator Validator = new ();
private static readonly RedactedSettingsValidator Validator = new();
public RedactedSettings()
{
@@ -1579,7 +1579,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly RuTrackerSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly RuTrackerTitleParser _titleParser = new ();
private readonly RuTrackerTitleParser _titleParser = new();
public RuTrackerParser(RuTrackerSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -1696,22 +1696,22 @@ namespace NzbDrone.Core.Indexers.Definitions
public class RuTrackerTitleParser
{
private static readonly List<Regex> FindTagsInTitlesRegexList = new ()
private static readonly List<Regex> FindTagsInTitlesRegexList = new()
{
new Regex(@"\((?>\((?<c>)|[^()]+|\)(?<-c>))*(?(c)(?!))\)"),
new Regex(@"\[(?>\[(?<c>)|[^\[\]]+|\](?<-c>))*(?(c)(?!))\]")
};
private readonly Regex _stripCyrillicRegex = new (@"(\([\p{IsCyrillic}\W]+\))|(^[\p{IsCyrillic}\W\d]+\/ )|([\p{IsCyrillic} \-]+,+)|([\p{IsCyrillic}]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _stripCyrillicRegex = new(@"(\([\p{IsCyrillic}\W]+\))|(^[\p{IsCyrillic}\W\d]+\/ )|([\p{IsCyrillic} \-]+,+)|([\p{IsCyrillic}]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleCommaRegex = new (@"\s(\d+),(\d+)", RegexOptions.Compiled);
private readonly Regex _tvTitleCyrillicXRegex = new (@"([\s-])Х+([\s\)\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleCommaRegex = new(@"\s(\d+),(\d+)", RegexOptions.Compiled);
private readonly Regex _tvTitleCyrillicXRegex = new(@"([\s-])Х+([\s\)\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonEpisodeOfRegex = new (@"Сезон\s*[:]*\s+(\d+).+(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)\s*из\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonEpisodeRegex = new (@"Сезон\s*[:]*\s+(\d+).+(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonRegex = new (@"Сезон\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeOfRegex = new (@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)\s*из\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeRegex = new (@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonEpisodeOfRegex = new(@"Сезон\s*[:]*\s+(\d+).+(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)\s*из\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonEpisodeRegex = new(@"Сезон\s*[:]*\s+(\d+).+(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonRegex = new(@"Сезон\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeOfRegex = new(@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)\s*из\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeRegex = new(@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public string Parse(string title,
ICollection<IndexerCategory> categories,
@@ -241,7 +241,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class SceneHDSettings : NoAuthTorrentBaseSettings
{
private static readonly SceneHDSettingsValidator Validator = new ();
private static readonly SceneHDSettingsValidator Validator = new();
public SceneHDSettings()
{
@@ -209,8 +209,8 @@ public class ShazbatParser : IParseIndexerResponse
private readonly IIndexerHttpClient _httpClient;
private readonly Logger _logger;
private readonly Regex _torrentInfoRegex = new (@"\((?<size>\d+)\):(?<seeders>\d+) \/ :(?<leechers>\d+)$", RegexOptions.Compiled);
private readonly HashSet<string> _hdResolutions = new () { "1080p", "1080i", "720p" };
private readonly Regex _torrentInfoRegex = new(@"\((?<size>\d+)\):(?<seeders>\d+) \/ :(?<leechers>\d+)$", RegexOptions.Compiled);
private readonly HashSet<string> _hdResolutions = new() { "1080p", "1080i", "720p" };
public ShazbatParser(ProviderDefinition definition, ShazbatSettings settings, TimeSpan rateLimit, IIndexerHttpClient httpClient, Logger logger)
{
@@ -393,7 +393,7 @@ public class ShazbatSettingsValidator : UserPassBaseSettingsValidator<ShazbatSet
public class ShazbatSettings : UserPassTorrentBaseSettings
{
private static readonly ShazbatSettingsValidator Validator = new ();
private static readonly ShazbatSettingsValidator Validator = new();
[FieldDefinition(4, Type = FieldType.Number, Label = "Show Pages Fetch Limit", HelpText = "The number of show pages should Prowlarr fetch when searching. Default: 2.")]
public int? ShowPagesFetchLimit { get; set; }
@@ -302,7 +302,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class SpeedAppSettings : NoAuthTorrentBaseSettings
{
private static readonly SpeedAppSettingsValidator Validator = new ();
private static readonly SpeedAppSettingsValidator Validator = new();
public SpeedAppSettings()
{
@@ -75,7 +75,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class SubsPleaseRequestGenerator : IIndexerRequestGenerator
{
private static readonly Regex ResolutionRegex = new (@"\d{3,4}p", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex ResolutionRegex = new(@"\d{3,4}p", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly NoAuthTorrentBaseSettings _settings;
@@ -172,7 +172,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class SubsPleaseParser : IParseIndexerResponse
{
private static readonly Regex RegexSize = new (@"\&xl=(?<size>\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex RegexSize = new(@"\&xl=(?<size>\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly NoAuthTorrentBaseSettings _settings;
@@ -355,7 +355,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly TolokaSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly TolokaTitleParser _titleParser = new ();
private readonly TolokaTitleParser _titleParser = new();
public TolokaParser(TolokaSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -437,30 +437,30 @@ namespace NzbDrone.Core.Indexers.Definitions
public class TolokaTitleParser
{
private static readonly List<Regex> FindTagsInTitlesRegexList = new ()
private static readonly List<Regex> FindTagsInTitlesRegexList = new()
{
new Regex(@"\((?>\((?<c>)|[^()]+|\)(?<-c>))*(?(c)(?!))\)"),
new Regex(@"\[(?>\[(?<c>)|[^\[\]]+|\](?<-c>))*(?(c)(?!))\]")
};
private readonly Regex _tvTitleCommaRegex = new (@"\s(\d+),(\d+)", RegexOptions.Compiled);
private readonly Regex _tvTitleCyrillicXRegex = new (@"([\s-])Х+([\)\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleCommaRegex = new(@"\s(\d+),(\d+)", RegexOptions.Compiled);
private readonly Regex _tvTitleCyrillicXRegex = new(@"([\s-])Х+([\)\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleMultipleSeasonsRegex = new (@"(?:Сезон|Seasons?)\s*[:]*\s+(\d+-\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleMultipleSeasonsRegex = new(@"(?:Сезон|Seasons?)\s*[:]*\s+(\d+-\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrSeasonEpisodeOfRegex = new (@"Сезон\s*[:]*\s+(\d+).+(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)\s*з\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrSeasonEpisodeRegex = new (@"Сезон\s*[:]*\s+(\d+).+(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrSeasonRegex = new (@"Сезон\s*[:]*\s+(\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrEpisodeOfRegex = new (@"(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)\s*з\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrEpisodeRegex = new (@"(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrSeasonEpisodeOfRegex = new(@"Сезон\s*[:]*\s+(\d+).+(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)\s*з\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrSeasonEpisodeRegex = new(@"Сезон\s*[:]*\s+(\d+).+(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrSeasonRegex = new(@"Сезон\s*[:]*\s+(\d+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrEpisodeOfRegex = new(@"(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)\s*з\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleUkrEpisodeRegex = new(@"(?:Серії|Серія|Серій|Епізод)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngSeasonEpisodeOfRegex = new (@"Season\s*[:]*\s+(\d+).+(?:Episodes?)+\s*[:]*\s+(\d+(?:-\d+)?)\s*of\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngSeasonEpisodeRegex = new (@"Season\s*[:]*\s+(\d+).+(?:Episodes?)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngSeasonRegex = new (@"Season\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngEpisodeOfRegex = new (@"(?:Episodes?)+\s*[:]*\s+(\d+(?:-\d+)?)\s*of\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngEpisodeRegex = new (@"(?:Episodes?)+\s*[:]+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngSeasonEpisodeOfRegex = new(@"Season\s*[:]*\s+(\d+).+(?:Episodes?)+\s*[:]*\s+(\d+(?:-\d+)?)\s*of\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngSeasonEpisodeRegex = new(@"Season\s*[:]*\s+(\d+).+(?:Episodes?)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngSeasonRegex = new(@"Season\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngEpisodeOfRegex = new(@"(?:Episodes?)+\s*[:]*\s+(\d+(?:-\d+)?)\s*of\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleEngEpisodeRegex = new(@"(?:Episodes?)+\s*[:]+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _stripCyrillicRegex = new (@"(\([\p{IsCyrillic}\W]+\))|(^[\p{IsCyrillic}\W\d]+\/ )|([\p{IsCyrillic} \-]+,+)|([\p{IsCyrillic}]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _stripCyrillicRegex = new(@"(\([\p{IsCyrillic}\W]+\))|(^[\p{IsCyrillic}\W\d]+\/ )|([\p{IsCyrillic} \-]+,+)|([\p{IsCyrillic}]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public string Parse(string title, ICollection<IndexerCategory> categories, bool stripCyrillicLetters = true)
{
@@ -12,7 +12,7 @@ namespace NzbDrone.Core.Indexers.Definitions.TorrentPotato
{
public class TorrentPotatoParser : IParseIndexerResponse
{
private static readonly Regex RegexGuid = new (@"^magnet:\?xt=urn:btih:([a-f0-9]+)", RegexOptions.Compiled);
private static readonly Regex RegexGuid = new(@"^magnet:\?xt=urn:btih:([a-f0-9]+)", RegexOptions.Compiled);
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
{
@@ -19,7 +19,7 @@ namespace NzbDrone.Core.Indexers.Definitions.TorrentPotato
public class TorrentPotatoSettings : ITorrentIndexerSettings
{
private static readonly TorrentPotatoSettingsValidator Validator = new ();
private static readonly TorrentPotatoSettingsValidator Validator = new();
[FieldDefinition(0, Label = "API URL", HelpText = "URL to TorrentPotato API")]
public string BaseUrl { get; set; }
@@ -31,10 +31,10 @@ namespace NzbDrone.Core.Indexers.Definitions.TorrentPotato
public string Passkey { get; set; }
[FieldDefinition(20)]
public IndexerBaseSettings BaseSettings { get; set; } = new ();
public IndexerBaseSettings BaseSettings { get; set; } = new();
[FieldDefinition(21)]
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new ();
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new();
public virtual NzbDroneValidationResult Validate()
{
@@ -17,7 +17,7 @@ namespace NzbDrone.Core.Indexers.Definitions.TorrentRss
public class TorrentRssIndexerSettings : ITorrentIndexerSettings
{
private static readonly TorrentRssIndexerSettingsValidator Validator = new ();
private static readonly TorrentRssIndexerSettingsValidator Validator = new();
public TorrentRssIndexerSettings()
{
@@ -38,10 +38,10 @@ namespace NzbDrone.Core.Indexers.Definitions.TorrentRss
public double? DefaultReleaseSize { get; set; }
[FieldDefinition(20)]
public IndexerBaseSettings BaseSettings { get; set; } = new ();
public IndexerBaseSettings BaseSettings { get; set; } = new();
[FieldDefinition(21)]
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new ();
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new();
public NzbDroneValidationResult Validate()
{
@@ -328,7 +328,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public class TorrentSyndikatSettings : NoAuthTorrentBaseSettings
{
private static readonly TorrentSyndikatSettingsValidator Validator = new ();
private static readonly TorrentSyndikatSettingsValidator Validator = new();
public TorrentSyndikatSettings()
{
@@ -34,10 +34,10 @@ namespace NzbDrone.Core.Indexers.Torznab
public class TorznabSettings : NewznabSettings, ITorrentIndexerSettings
{
private static readonly TorznabSettingsValidator Validator = new ();
private static readonly TorznabSettingsValidator Validator = new();
[FieldDefinition(3)]
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new ();
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new();
public override NzbDroneValidationResult Validate()
{
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D
public class Unit3dSettings : NoAuthTorrentBaseSettings
{
private static readonly Unit3dSettingsValidator Validator = new ();
private static readonly Unit3dSettingsValidator Validator = new();
[FieldDefinition(2, Label = "ApiKey", HelpText = "Site API Key generated in My Security", Privacy = PrivacyLevel.ApiKey)]
public string ApiKey { get; set; }
@@ -290,7 +290,7 @@ public class XSpeedsParser : IParseIndexerResponse
private readonly XSpeedsSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
private readonly Regex _dateAddedRegex = new (@"\d{2}-\d{2}-\d{4} \d{2}:\d{2}", RegexOptions.Compiled);
private readonly Regex _dateAddedRegex = new(@"\d{2}-\d{2}-\d{4} \d{2}:\d{2}", RegexOptions.Compiled);
public XSpeedsParser(XSpeedsSettings settings, IndexerCapabilitiesCategories categories)
{
@@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Xthor
public class XthorSettings : NoAuthTorrentBaseSettings
{
private static readonly XthorSettingsValidator Validator = new ();
private static readonly XthorSettingsValidator Validator = new();
public XthorSettings()
{