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 @@ public override HealthCheck Check()
{
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)
{

View file

@ -29,15 +29,11 @@ public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, I
private const int DEFINITION_VERSION = 3;
private readonly List<string> _defintionBlocklist = new List<string>()
{
"aither",
"animeworld",
"blutopia",
"beyond-hd",
"beyond-hd-oneurl",
"danishbytes",
"desitorrents",
"hdbits",
"shareisland",
"lat-team"
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,6 +27,7 @@ public interface IIndexer : IProvider
Task<IndexerPageableQueryResult> Fetch(BasicSearchCriteria searchCriteria);
Task<byte[]> Download(Uri link);
bool IsObsolete();
IndexerCapabilities GetCapabilities();
}

View file

@ -45,6 +45,18 @@ public IndexerBase(IIndexerStatusService indexerStatusService, IConfigService co
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 IEnumerable<ProviderDefinition> DefaultDefinitions

View file

@ -147,6 +147,11 @@ public override IEnumerable<IndexerDefinition> GetDefaultDefinitions()
{
foreach (var provider in _providers)
{
if (provider.IsObsolete())
{
continue;
}
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));

View file

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