Radarr/NzbDrone.Core/Indexers/IndexerBase.cs

64 lines
1.8 KiB
C#
Raw Normal View History

2013-04-07 07:30:37 +00:00
using System;
using System.Collections.Generic;
using NzbDrone.Core.ThingiProvider;
2013-04-07 07:30:37 +00:00
namespace NzbDrone.Core.Indexers
{
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
{
var config = (IProviderConfig)new TSettings();
yield return new IndexerDefinition
{
Name = GetType().Name,
Enable = config.Validate().IsValid,
Implementation = GetType().Name,
Settings = config
};
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; }
public abstract IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber);
public abstract IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date);
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-22 20:00:29 +00:00
public enum DownloadProtocol
{
Usenet,
Torrent
}
2013-04-07 07:30:37 +00:00
}