2011-01-29 06:10:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Model;
|
2011-04-04 03:50:12 +00:00
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
2011-01-29 06:10:22 +00:00
|
|
|
|
using SubSonic.Repository;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
|
{
|
2011-04-09 00:21:57 +00:00
|
|
|
|
public class IndexerProvider
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
private readonly IRepository _sonicRepo;
|
2011-04-10 01:34:36 +00:00
|
|
|
|
private readonly ConfigProvider _configProvider;
|
2011-01-29 06:10:22 +00:00
|
|
|
|
|
2011-04-10 01:34:36 +00:00
|
|
|
|
public IndexerProvider(IRepository sonicRepo, ConfigProvider configProvider)
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
_sonicRepo = sonicRepo;
|
2011-03-17 07:40:23 +00:00
|
|
|
|
_configProvider = configProvider;
|
2011-01-29 06:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 00:21:57 +00:00
|
|
|
|
#region IndexerProvider Members
|
2011-01-29 06:10:22 +00:00
|
|
|
|
|
2011-04-09 00:21:57 +00:00
|
|
|
|
public virtual List<Indexer> AllIndexers()
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
return _sonicRepo.All<Indexer>().OrderBy(i => i.Order).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 00:21:57 +00:00
|
|
|
|
public virtual List<Indexer> EnabledIndexers()
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
return _sonicRepo.All<Indexer>().Where(i => i.Enabled).OrderBy(i => i.Order).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 00:21:57 +00:00
|
|
|
|
public virtual void Update(Indexer indexer)
|
2011-01-29 06:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
_sonicRepo.Update(indexer);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 00:21:57 +00:00
|
|
|
|
public virtual Indexer Single(int indexerId)
|
2011-03-23 05:19:23 +00:00
|
|
|
|
{
|
|
|
|
|
return _sonicRepo.Single<Indexer>(indexerId);
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-29 06:10:22 +00:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|