mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
removed some unneeded injection dependencies. renamed dependency fields to be standard across the app.
This commit is contained in:
parent
c8252495af
commit
17c8b8803b
10 changed files with 111 additions and 117 deletions
|
@ -10,11 +10,11 @@ namespace NzbDrone.Core.Providers
|
|||
public class SeasonProvider
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IRepository _sonicRepo;
|
||||
private readonly IRepository _repository;
|
||||
|
||||
public SeasonProvider(IRepository dataRepository)
|
||||
public SeasonProvider(IRepository repository)
|
||||
{
|
||||
_sonicRepo = dataRepository;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public SeasonProvider()
|
||||
|
@ -23,27 +23,27 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
public virtual Season GetSeason(int seasonId)
|
||||
{
|
||||
return _sonicRepo.Single<Season>(seasonId);
|
||||
return _repository.Single<Season>(seasonId);
|
||||
}
|
||||
|
||||
public virtual Season GetSeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
return _sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
||||
return _repository.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
||||
}
|
||||
|
||||
public virtual List<Season> GetSeasons(int seriesId)
|
||||
{
|
||||
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).ToList();
|
||||
return _repository.All<Season>().Where(s => s.SeriesId == seriesId).ToList();
|
||||
}
|
||||
|
||||
public virtual Season GetLatestSeason(int seriesId)
|
||||
{
|
||||
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).OrderBy(s => s.SeasonNumber).Last();
|
||||
return _repository.All<Season>().Where(s => s.SeriesId == seriesId).OrderBy(s => s.SeasonNumber).Last();
|
||||
}
|
||||
|
||||
public virtual void EnsureSeason(int seriesId, int seasonId, int seasonNumber)
|
||||
{
|
||||
if (_sonicRepo.Exists<Season>(s => s.SeasonId == seasonId))
|
||||
if (_repository.Exists<Season>(s => s.SeasonId == seasonId))
|
||||
return;
|
||||
//TODO: Calculate Season Folder
|
||||
Logger.Trace("Adding Season To DB. [SeriesID:{0} SeasonID:{1} SeasonNumber:{2}]", seriesId, seasonId,
|
||||
|
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Providers
|
|||
SeasonNumber = seasonNumber,
|
||||
SeriesId = seriesId
|
||||
};
|
||||
_sonicRepo.Add(newSeason);
|
||||
_repository.Add(newSeason);
|
||||
}
|
||||
|
||||
public virtual int SaveSeason(Season season)
|
||||
|
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
public virtual bool IsIgnored(int seasonId)
|
||||
{
|
||||
if (_sonicRepo.Single<Season>(seasonId).Monitored)
|
||||
if (_repository.Single<Season>(seasonId).Monitored)
|
||||
return false;
|
||||
|
||||
Logger.Debug("Season {0} is not wanted.");
|
||||
|
@ -75,13 +75,13 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
public virtual bool IsIgnored(int seriesId, int seasonNumber)
|
||||
{
|
||||
var season = _sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
||||
var season = _repository.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
|
||||
return !season.Monitored;
|
||||
}
|
||||
|
||||
public void DeleteSeason(int seasonId)
|
||||
{
|
||||
_sonicRepo.Delete<Season>(seasonId);
|
||||
_repository.Delete<Season>(seasonId);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue