Allow Obsolete of C# Indexer Implementations

This commit is contained in:
Qstick
2021-11-13 21:51:19 -06:00
parent 6200c9e496
commit 1abd14ee86
19 changed files with 40 additions and 6 deletions

View File

@@ -27,7 +27,8 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
var blocklist = _indexerDefinitionUpdateService.GetBlocklist(); var blocklist = _indexerDefinitionUpdateService.GetBlocklist();
var oldIndexers = _indexerFactory.All().Where(i => i.Implementation == "Cardigann" && blocklist.Contains(((CardigannSettings)i.Settings).DefinitionFile)).ToList(); var oldIndexers = _indexerFactory.AllProviders(false)
.Where(i => i.IsObsolete() || (i.Definition.Implementation == "Cardigann" && blocklist.Contains(((CardigannSettings)i.Definition.Settings).DefinitionFile))).ToList();
if (oldIndexers.Count == 0) if (oldIndexers.Count == 0)
{ {

View File

@@ -29,15 +29,11 @@ namespace NzbDrone.Core.IndexerVersions
private const int DEFINITION_VERSION = 3; private const int DEFINITION_VERSION = 3;
private readonly List<string> _defintionBlocklist = new List<string>() private readonly List<string> _defintionBlocklist = new List<string>()
{ {
"aither",
"animeworld", "animeworld",
"blutopia",
"beyond-hd", "beyond-hd",
"beyond-hd-oneurl", "beyond-hd-oneurl",
"danishbytes", "danishbytes",
"desitorrents",
"hdbits", "hdbits",
"shareisland",
"lat-team" "lat-team"
}; };

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
@@ -7,6 +8,7 @@ using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class Aither : Unit3dBase public class Aither : Unit3dBase
{ {
public override string Name => "Aither"; public override string Name => "Aither";

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
@@ -7,6 +8,7 @@ using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class AnimeWorld : Unit3dBase public class AnimeWorld : Unit3dBase
{ {
public override string Name => "AnimeWorld"; public override string Name => "AnimeWorld";

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
@@ -7,6 +8,7 @@ using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class Blutopia : Unit3dBase public class Blutopia : Unit3dBase
{ {
public override string Name => "Blutopia"; public override string Name => "Blutopia";

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
@@ -8,6 +9,7 @@ using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class DesiTorrents : Unit3dBase public class DesiTorrents : Unit3dBase
{ {
public override string Name => "DesiTorrents"; public override string Name => "DesiTorrents";

View File

@@ -20,6 +20,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class DigitalCore : TorrentIndexerBase<DigitalCoreSettings> public class DigitalCore : TorrentIndexerBase<DigitalCoreSettings>
{ {
public override string Name => "DigitalCore"; public override string Name => "DigitalCore";

View File

@@ -17,6 +17,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class InternetArchive : TorrentIndexerBase<InternetArchiveSettings> public class InternetArchive : TorrentIndexerBase<InternetArchiveSettings>
{ {
public override string Name => "Internet Archive"; public override string Name => "Internet Archive";

View File

@@ -15,6 +15,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class Milkie : TorrentIndexerBase<MilkieSettings> public class Milkie : TorrentIndexerBase<MilkieSettings>
{ {
public override string Name => "Milkie"; public override string Name => "Milkie";

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
@@ -7,6 +8,7 @@ using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class ShareIsland : Unit3dBase public class ShareIsland : Unit3dBase
{ {
public override string Name => "ShareIsland"; public override string Name => "ShareIsland";

View File

@@ -18,6 +18,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class SuperBits : TorrentIndexerBase<SuperBitsSettings> public class SuperBits : TorrentIndexerBase<SuperBitsSettings>
{ {
public override string Name => "SuperBits"; public override string Name => "SuperBits";

View File

@@ -16,6 +16,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class ThePirateBay : TorrentIndexerBase<ThePirateBaySettings> public class ThePirateBay : TorrentIndexerBase<ThePirateBaySettings>
{ {
public override string Name => "ThePirateBay"; public override string Name => "ThePirateBay";

View File

@@ -20,6 +20,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class TorrentLeech : TorrentIndexerBase<TorrentLeechSettings> public class TorrentLeech : TorrentIndexerBase<TorrentLeechSettings>
{ {
public override string Name => "TorrentLeech"; public override string Name => "TorrentLeech";

View File

@@ -18,6 +18,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class TorrentParadiseMl : TorrentIndexerBase<TorrentParadiseMlSettings> public class TorrentParadiseMl : TorrentIndexerBase<TorrentParadiseMlSettings>
{ {
public override string Name => "TorrentParadiseMl"; public override string Name => "TorrentParadiseMl";

View File

@@ -18,6 +18,7 @@ using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
[Obsolete]
public class YTS : TorrentIndexerBase<YTSSettings> public class YTS : TorrentIndexerBase<YTSSettings>
{ {
public override string Name => "YTS"; public override string Name => "YTS";

View File

@@ -27,6 +27,7 @@ namespace NzbDrone.Core.Indexers
Task<IndexerPageableQueryResult> Fetch(BasicSearchCriteria searchCriteria); Task<IndexerPageableQueryResult> Fetch(BasicSearchCriteria searchCriteria);
Task<byte[]> Download(Uri link); Task<byte[]> Download(Uri link);
bool IsObsolete();
IndexerCapabilities GetCapabilities(); IndexerCapabilities GetCapabilities();
} }

View File

@@ -45,6 +45,18 @@ namespace NzbDrone.Core.Indexers
public Type ConfigContract => typeof(TSettings); public Type ConfigContract => typeof(TSettings);
public bool IsObsolete()
{
var attributes = GetType().GetCustomAttributes(false);
foreach (ObsoleteAttribute attribute in attributes.OfType<ObsoleteAttribute>())
{
return true;
}
return false;
}
public virtual ProviderMessage Message => null; public virtual ProviderMessage Message => null;
public virtual IEnumerable<ProviderDefinition> DefaultDefinitions public virtual IEnumerable<ProviderDefinition> DefaultDefinitions

View File

@@ -147,6 +147,11 @@ namespace NzbDrone.Core.Indexers
{ {
foreach (var provider in _providers) foreach (var provider in _providers)
{ {
if (provider.IsObsolete())
{
continue;
}
var definitions = provider.DefaultDefinitions var definitions = provider.DefaultDefinitions
.Where(v => v.Name != null && (v.Name != typeof(Cardigann.Cardigann).Name || v.Name != typeof(Newznab.Newznab).Name || v.Name != typeof(Torznab.Torznab).Name)); .Where(v => v.Name != null && (v.Name != typeof(Cardigann.Cardigann).Name || v.Name != typeof(Newznab.Newznab).Name || v.Name != typeof(Torznab.Torznab).Name));

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using FluentValidation.Results; using FluentValidation.Results;
@@ -11,6 +11,7 @@ namespace NzbDrone.Core.ThingiProvider
ProviderMessage Message { get; } ProviderMessage Message { get; }
IEnumerable<ProviderDefinition> DefaultDefinitions { get; } IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
ProviderDefinition Definition { get; set; } ProviderDefinition Definition { get; set; }
ValidationResult Test(); ValidationResult Test();
object RequestAction(string stage, IDictionary<string, string> query); object RequestAction(string stage, IDictionary<string, string> query);
} }