mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Interim commit
This commit is contained in:
43
src/Jackett/Indexers/BaseIndexer.cs
Normal file
43
src/Jackett/Indexers/BaseIndexer.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jackett.Models;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
|
||||
namespace Jackett.Indexers
|
||||
{
|
||||
public abstract class BaseIndexer: IndexerInterface
|
||||
{
|
||||
public string DisplayDescription { get; }
|
||||
public string DisplayName { get; }
|
||||
public bool IsConfigured { get; protected set; }
|
||||
public Uri SiteLink { get; }
|
||||
|
||||
public abstract Task ApplyConfiguration(JToken configJson);
|
||||
public abstract Task<byte[]> Download(Uri link);
|
||||
public abstract Task<ConfigurationData> GetConfigurationForSetup();
|
||||
public abstract void LoadFromSavedConfiguration(JToken jsonConfig);
|
||||
public abstract Task<ReleaseInfo[]> PerformQuery(TorznabQuery query);
|
||||
|
||||
private Logger logger;
|
||||
|
||||
public BaseIndexer(string name, string description, Uri link, Logger logger)
|
||||
{
|
||||
DisplayName = name;
|
||||
DisplayDescription = description;
|
||||
SiteLink = link;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
protected void LogParseError(string results, Exception ex)
|
||||
{
|
||||
var fileName = string.Format("Error on {0} for {1}.txt", DateTime.Now.ToString("yyyyMMddHHmmss"), DisplayName);
|
||||
var spacing = string.Join("", Enumerable.Repeat(Environment.NewLine, 5));
|
||||
var fileContents = string.Format("{0}{1}{2}", ex, spacing, results);
|
||||
logger.Error(fileName + fileContents);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user