2011-01-29 08:10:22 +02: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 06:50:12 +03:00
|
|
|
using NzbDrone.Core.Providers.Core;
|
2011-01-29 08:10:22 +02:00
|
|
|
using SubSonic.Repository;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
{
|
|
|
|
public class IndexerProvider : IIndexerProvider
|
|
|
|
{
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
private readonly IRepository _sonicRepo;
|
2011-03-17 09:40:23 +02:00
|
|
|
private readonly IConfigProvider _configProvider;
|
2011-01-29 08:10:22 +02:00
|
|
|
|
2011-03-17 09:40:23 +02:00
|
|
|
public IndexerProvider(IRepository sonicRepo, IConfigProvider configProvider)
|
2011-01-29 08:10:22 +02:00
|
|
|
{
|
|
|
|
_sonicRepo = sonicRepo;
|
2011-03-17 09:40:23 +02:00
|
|
|
_configProvider = configProvider;
|
2011-01-29 08:10:22 +02:00
|
|
|
}
|
|
|
|
|
2011-03-17 09:40:23 +02:00
|
|
|
#region IIndexerProvider Members
|
2011-01-29 08:10:22 +02:00
|
|
|
|
|
|
|
public List<Indexer> AllIndexers()
|
|
|
|
{
|
|
|
|
return _sonicRepo.All<Indexer>().OrderBy(i => i.Order).ToList();
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Indexer> EnabledIndexers()
|
|
|
|
{
|
|
|
|
return _sonicRepo.All<Indexer>().Where(i => i.Enabled).OrderBy(i => i.Order).ToList();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Update(Indexer indexer)
|
|
|
|
{
|
|
|
|
_sonicRepo.Update(indexer);
|
|
|
|
}
|
|
|
|
|
2011-03-23 07:19:23 +02:00
|
|
|
public Indexer Single(int indexerId)
|
|
|
|
{
|
|
|
|
return _sonicRepo.Single<Indexer>(indexerId);
|
|
|
|
}
|
|
|
|
|
2011-01-29 08:10:22 +02:00
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|