parent
1465fbf499
commit
2eb3ead230
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public interface IIndexerBase
|
||||
{
|
||||
string Name { get; }
|
||||
bool EnabledByDefault { get; }
|
||||
|
||||
IEnumerable<string> RecentFeed { get; }
|
||||
|
||||
IParseFeed Parser { get; }
|
||||
|
||||
bool IsConfigured { get; }
|
||||
|
||||
IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber);
|
||||
IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date);
|
||||
IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber);
|
||||
IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using NzbDrone.Common.Eventing;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public class IndexerSettingUpdatedEvent : IEvent
|
||||
{
|
||||
public string IndexerName { get; private set; }
|
||||
public IIndexerSetting IndexerSetting { get; private set; }
|
||||
|
||||
public IndexerSettingUpdatedEvent(string indexerName, IIndexerSetting indexerSetting)
|
||||
{
|
||||
IndexerName = indexerName;
|
||||
IndexerSetting = indexerSetting;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using NzbDrone.Common.Eventing;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public abstract class IndexerWithSetting<TSetting> :
|
||||
Indexer,
|
||||
IHandle<IndexerSettingUpdatedEvent> where TSetting : IIndexerSetting, new()
|
||||
{
|
||||
protected IndexerWithSetting(IProviderIndexerSetting settingProvider)
|
||||
{
|
||||
Settings = settingProvider.Get<TSetting>(this);
|
||||
}
|
||||
|
||||
public override bool IsConfigured
|
||||
{
|
||||
get { return Settings.IsValid; }
|
||||
}
|
||||
|
||||
protected TSetting Settings { get; private set; }
|
||||
|
||||
public void Handle(IndexerSettingUpdatedEvent message)
|
||||
{
|
||||
if (message.IndexerName.Equals(Name, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
Settings = (TSetting)message.IndexerSetting;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue