2013-04-07 07:30:37 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2013-09-21 07:09:26 +00:00
|
|
|
using NzbDrone.Core.ThingiProvider;
|
2013-04-07 07:30:37 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Indexers
|
|
|
|
{
|
2013-10-01 19:32:08 +00:00
|
|
|
public abstract class IndexerBase<TSettings> : IIndexer where TSettings : IProviderConfig, new()
|
2013-04-07 07:30:37 +00:00
|
|
|
{
|
2013-09-22 20:00:29 +00:00
|
|
|
public Type ConfigContract
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return typeof(TSettings);
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 07:30:37 +00:00
|
|
|
|
2013-09-22 05:20:26 +00:00
|
|
|
public virtual IEnumerable<ProviderDefinition> DefaultDefinitions
|
2013-04-07 07:30:37 +00:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2013-10-01 19:32:08 +00:00
|
|
|
var config = (IProviderConfig)new TSettings();
|
|
|
|
|
2013-05-02 01:59:09 +00:00
|
|
|
yield return new IndexerDefinition
|
|
|
|
{
|
2013-10-01 19:32:08 +00:00
|
|
|
Name = GetType().Name,
|
|
|
|
Enable = config.Validate().IsValid,
|
2013-05-02 01:59:09 +00:00
|
|
|
Implementation = GetType().Name,
|
2013-10-01 19:32:08 +00:00
|
|
|
Settings = config
|
2013-05-02 01:59:09 +00:00
|
|
|
};
|
2013-04-07 07:30:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-22 05:20:26 +00:00
|
|
|
public ProviderDefinition Definition { get; set; }
|
|
|
|
|
2013-09-22 20:00:29 +00:00
|
|
|
public abstract DownloadProtocol Protocol { get; }
|
2013-09-22 05:20:26 +00:00
|
|
|
|
|
|
|
protected TSettings Settings
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return (TSettings)Definition.Settings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-13 23:17:58 +00:00
|
|
|
public virtual IParseFeed Parser { get; private set; }
|
2013-04-07 07:30:37 +00:00
|
|
|
|
|
|
|
public abstract IEnumerable<string> RecentFeed { get; }
|
2013-08-06 07:38:16 +00:00
|
|
|
public abstract IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber);
|
|
|
|
public abstract IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date);
|
2013-08-22 04:42:25 +00:00
|
|
|
public abstract IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int offset);
|
2013-09-22 20:00:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return GetType().Name;
|
|
|
|
}
|
2013-04-07 07:30:37 +00:00
|
|
|
}
|
2013-09-14 00:10:39 +00:00
|
|
|
|
2013-09-22 20:00:29 +00:00
|
|
|
public enum DownloadProtocol
|
2013-09-14 00:10:39 +00:00
|
|
|
{
|
|
|
|
Usenet,
|
|
|
|
Torrent
|
|
|
|
}
|
2013-04-07 07:30:37 +00:00
|
|
|
}
|