mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (Cardigann) Update namespace and use nameof()
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.IndexerTests.CardigannTests
|
namespace NzbDrone.Core.Test.IndexerTests.CardigannTests
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.IndexerVersions;
|
using NzbDrone.Core.IndexerVersions;
|
||||||
using NzbDrone.Core.Localization;
|
using NzbDrone.Core.Localization;
|
||||||
using NzbDrone.Core.ThingiProvider.Events;
|
using NzbDrone.Core.ThingiProvider.Events;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.IndexerVersions;
|
using NzbDrone.Core.IndexerVersions;
|
||||||
using NzbDrone.Core.Localization;
|
using NzbDrone.Core.Localization;
|
||||||
using NzbDrone.Core.ThingiProvider.Events;
|
using NzbDrone.Core.ThingiProvider.Events;
|
||||||
|
@@ -8,7 +8,7 @@ using NzbDrone.Common.Cache;
|
|||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
@@ -14,7 +14,7 @@ using NzbDrone.Core.Parser.Model;
|
|||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class Cardigann : TorrentIndexerBase<CardigannSettings>
|
public class Cardigann : TorrentIndexerBase<CardigannSettings>
|
||||||
{
|
{
|
||||||
|
@@ -15,7 +15,7 @@ using NzbDrone.Common.Serializer;
|
|||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class CardigannBase
|
public class CardigannBase
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
// A Dictionary allowing the same key multiple times
|
// A Dictionary allowing the same key multiple times
|
||||||
public class KeyValuePairList : List<KeyValuePair<string, SelectorBlock>>, IDictionary<string, SelectorBlock>
|
public class KeyValuePairList : List<KeyValuePair<string, SelectorBlock>>, IDictionary<string, SelectorBlock>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class CardigannMetaDefinition
|
public class CardigannMetaDefinition
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using AngleSharp.Dom;
|
using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using AngleSharp.Xml.Parser;
|
using AngleSharp.Xml.Parser;
|
||||||
@@ -16,7 +15,7 @@ using NzbDrone.Core.Indexers.Exceptions;
|
|||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class CardigannParser : CardigannBase, IParseIndexerResponse
|
public class CardigannParser : CardigannBase, IParseIndexerResponse
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class CardigannRequest : IndexerRequest
|
public class CardigannRequest : IndexerRequest
|
||||||
{
|
{
|
||||||
|
@@ -12,13 +12,12 @@ using NLog;
|
|||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
|
||||||
using NzbDrone.Core.Indexers.Definitions.Cardigann.Exceptions;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann.Exceptions;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class CardigannRequestGenerator : CardigannBase, IIndexerRequestGenerator
|
public class CardigannRequestGenerator : CardigannBase, IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
@@ -590,7 +589,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Captcha> GetConfigurationForSetup(bool automaticlogin)
|
public async Task<Captcha> GetConfigurationForSetup(bool automaticLogin)
|
||||||
{
|
{
|
||||||
var login = _definition.Login;
|
var login = _definition.Login;
|
||||||
|
|
||||||
@@ -643,7 +642,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
captcha = await GetCaptcha(login);
|
captcha = await GetCaptcha(login);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (captcha != null && automaticlogin)
|
if (captcha != null && automaticLogin)
|
||||||
{
|
{
|
||||||
_logger.Error("CardigannIndexer ({0}): Found captcha during automatic login, aborting", _definition.Id);
|
_logger.Error("CardigannIndexer ({0}): Found captcha during automatic login, aborting", _definition.Id);
|
||||||
}
|
}
|
||||||
@@ -1105,7 +1104,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
var rawStr = ApplyGoTemplateText(input.Value, variables, WebUtility.UrlEncode);
|
var rawStr = ApplyGoTemplateText(input.Value, variables, WebUtility.UrlEncode);
|
||||||
foreach (var part in rawStr.Split('&'))
|
foreach (var part in rawStr.Split('&'))
|
||||||
{
|
{
|
||||||
var parts = part.Split(new char[] { '=' }, 2);
|
var parts = part.Split(new[] { '=' }, 2);
|
||||||
var key = parts[0];
|
var key = parts[0];
|
||||||
if (key.Length == 0)
|
if (key.Length == 0)
|
||||||
{
|
{
|
||||||
|
@@ -1,11 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FluentValidation;
|
|
||||||
using FluentValidation.Results;
|
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
using NzbDrone.Core.Indexers.Settings;
|
using NzbDrone.Core.Indexers.Settings;
|
||||||
using NzbDrone.Core.Validation;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||||
{
|
{
|
||||||
public class CardigannSettings : NoAuthTorrentBaseSettings
|
public class CardigannSettings : NoAuthTorrentBaseSettings
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
using NzbDrone.Core.Indexers.Cardigann;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Definitions.Cardigann.Exceptions
|
namespace NzbDrone.Core.Indexers.Definitions.Cardigann.Exceptions
|
||||||
{
|
{
|
||||||
public class CardigannConfigException : CardigannException
|
public class CardigannConfigException : CardigannException
|
||||||
|
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.Indexers.Newznab;
|
using NzbDrone.Core.Indexers.Newznab;
|
||||||
using NzbDrone.Core.IndexerVersions;
|
using NzbDrone.Core.IndexerVersions;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
|
|
||||||
foreach (var definition in definitions)
|
foreach (var definition in definitions)
|
||||||
{
|
{
|
||||||
if (definition.Implementation == typeof(Cardigann.Cardigann).Name)
|
if (definition.Implementation == nameof(Cardigann))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
{
|
{
|
||||||
var definition = base.Get(id);
|
var definition = base.Get(id);
|
||||||
|
|
||||||
if (definition.Implementation == typeof(Cardigann.Cardigann).Name)
|
if (definition.Implementation == nameof(Cardigann))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -177,7 +177,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var definitions = provider.DefaultDefinitions
|
var definitions = provider.DefaultDefinitions
|
||||||
.Where(v => v.Name != null && v.Name != nameof(Cardigann.Cardigann) && v.Name != nameof(Newznab.Newznab) && v.Name != nameof(Torznab.Torznab));
|
.Where(v => v.Name != null && v.Name != nameof(Cardigann) && v.Name != nameof(Newznab.Newznab) && v.Name != nameof(Torznab.Torznab));
|
||||||
|
|
||||||
foreach (IndexerDefinition definition in definitions)
|
foreach (IndexerDefinition definition in definitions)
|
||||||
{
|
{
|
||||||
@@ -203,7 +203,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
definition.SupportsPagination = provider.SupportsPagination;
|
definition.SupportsPagination = provider.SupportsPagination;
|
||||||
|
|
||||||
//We want to use the definition Caps and Privacy for Cardigann instead of the provider.
|
//We want to use the definition Caps and Privacy for Cardigann instead of the provider.
|
||||||
if (definition.Implementation != nameof(Cardigann.Cardigann))
|
if (definition.Implementation != nameof(Cardigann))
|
||||||
{
|
{
|
||||||
definition.IndexerUrls = provider.IndexerUrls;
|
definition.IndexerUrls = provider.IndexerUrls;
|
||||||
definition.LegacyUrls = provider.LegacyUrls;
|
definition.LegacyUrls = provider.LegacyUrls;
|
||||||
@@ -276,13 +276,13 @@ namespace NzbDrone.Core.Indexers
|
|||||||
|
|
||||||
SetProviderCharacteristics(provider, definition);
|
SetProviderCharacteristics(provider, definition);
|
||||||
|
|
||||||
if (definition.Implementation == typeof(Newznab.Newznab).Name || definition.Implementation == typeof(Torznab.Torznab).Name)
|
if (definition.Implementation is nameof(Newznab.Newznab) or nameof(Torznab.Torznab))
|
||||||
{
|
{
|
||||||
var settings = (NewznabSettings)definition.Settings;
|
var settings = (NewznabSettings)definition.Settings;
|
||||||
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList() ?? null;
|
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList() ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.Implementation == typeof(Cardigann.Cardigann).Name)
|
if (definition.Implementation == nameof(Cardigann))
|
||||||
{
|
{
|
||||||
MapCardigannDefinition(definition);
|
MapCardigannDefinition(definition);
|
||||||
}
|
}
|
||||||
@@ -296,13 +296,13 @@ namespace NzbDrone.Core.Indexers
|
|||||||
|
|
||||||
SetProviderCharacteristics(provider, definition);
|
SetProviderCharacteristics(provider, definition);
|
||||||
|
|
||||||
if (definition.Enable && (definition.Implementation == typeof(Newznab.Newznab).Name || definition.Implementation == typeof(Torznab.Torznab).Name))
|
if (definition.Enable && definition.Implementation is nameof(Newznab.Newznab) or nameof(Torznab.Torznab))
|
||||||
{
|
{
|
||||||
var settings = (NewznabSettings)definition.Settings;
|
var settings = (NewznabSettings)definition.Settings;
|
||||||
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList() ?? null;
|
settings.Categories = _newznabCapabilitiesProvider.GetCapabilities(settings, definition)?.Categories.GetTorznabCategoryList() ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.Implementation == typeof(Cardigann.Cardigann).Name)
|
if (definition.Implementation == nameof(Cardigann))
|
||||||
{
|
{
|
||||||
MapCardigannDefinition(definition);
|
MapCardigannDefinition(definition);
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.IndexerVersions;
|
using NzbDrone.Core.IndexerVersions;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using Prowlarr.Http.ClientSchema;
|
using Prowlarr.Http.ClientSchema;
|
||||||
@@ -112,7 +111,7 @@ namespace Prowlarr.Api.V1.Indexers
|
|||||||
|
|
||||||
var definition = base.ToModel(resource);
|
var definition = base.ToModel(resource);
|
||||||
|
|
||||||
if (resource.Implementation == typeof(Cardigann).Name)
|
if (resource.Implementation == nameof(Cardigann))
|
||||||
{
|
{
|
||||||
var standardFields = base.ToResource(definition).Fields.Select(x => x.Name).ToList();
|
var standardFields = base.ToResource(definition).Fields.Select(x => x.Name).ToList();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user