Jackett/src/Jackett.Common/Indexers/IIndexer.cs

68 lines
2.0 KiB
C#
Raw Normal View History

2020-02-09 02:35:16 +00:00
using System;
2015-04-13 06:25:21 +00:00
using System.Collections.Generic;
2018-06-15 09:12:03 +00:00
using System.Text;
2015-04-13 06:25:21 +00:00
using System.Threading.Tasks;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig;
using Newtonsoft.Json.Linq;
2015-04-13 06:25:21 +00:00
namespace Jackett.Common.Indexers
2015-04-13 06:25:21 +00:00
{
public class IndexerResult
{
public IIndexer Indexer { get; set; }
public IEnumerable<ReleaseInfo> Releases { get; set; }
public bool IsFromCache;
public IndexerResult(IIndexer indexer, IEnumerable<ReleaseInfo> releases, bool isFromCache)
{
Indexer = indexer;
Releases = releases;
IsFromCache = isFromCache;
}
}
2015-07-19 13:22:50 +00:00
public interface IIndexer
2015-04-13 06:25:21 +00:00
{
string SiteLink { get; }
string[] AlternativeSiteLinks { get; }
2015-04-13 14:25:41 +00:00
string DisplayName { get; }
string DisplayDescription { get; }
string Type { get; }
2016-12-02 17:58:10 +00:00
string Language { get; }
2016-12-05 10:43:07 +00:00
string LastError { get; set; }
string Id { get; }
2018-06-15 09:12:03 +00:00
Encoding Encoding { get; }
2015-07-19 19:28:08 +00:00
TorznabCapabilities TorznabCaps { get; }
2015-04-25 19:37:03 +00:00
// Whether this indexer has been configured, verified and saved in the past and has the settings required for functioning
bool IsConfigured { get; }
string[] Tags { get; }
// Retrieved for starting setup for the indexer via web API
2015-04-13 06:25:21 +00:00
Task<ConfigurationData> GetConfigurationForSetup();
// Called when web API wants to apply setup configuration via web API, usually this is where login and storing cookie happens
Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson);
2015-04-13 06:25:21 +00:00
// Called on startup when initializing indexers from saved configuration
void LoadFromSavedConfiguration(JToken jsonConfig);
void SaveConfig();
2015-04-16 06:04:28 +00:00
void Unconfigure();
2021-05-16 18:13:54 +00:00
Task<IndexerResult> ResultsForQuery(TorznabQuery query, bool isMetaIndexer = false);
bool CanHandleQuery(TorznabQuery query);
}
2015-04-17 03:53:52 +00:00
public interface IWebIndexer : IIndexer
{
2015-04-17 03:53:52 +00:00
Task<byte[]> Download(Uri link);
2015-04-13 06:25:21 +00:00
}
}