mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
moved series/season/episodes to object db.
This commit is contained in:
parent
4504232956
commit
b5644bf660
93 changed files with 1025 additions and 1338 deletions
49
NzbDrone.Core/Tv/SeasonRepository.cs
Normal file
49
NzbDrone.Core/Tv/SeasonRepository.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Tv
|
||||
{
|
||||
public interface ISeasonRepository : IBasicRepository<Season>
|
||||
{
|
||||
IList<int> GetSeasonNumbers(int seriesId);
|
||||
Season Get(int seriesId, int seasonNumber);
|
||||
bool IsIgnored(int seriesId, int seasonNumber);
|
||||
List<Season> GetSeasonBySeries(int seriesId);
|
||||
}
|
||||
|
||||
public class SeasonRepository : BasicRepository<Season>, ISeasonRepository
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IDatabase _database;
|
||||
|
||||
public SeasonRepository(IObjectDatabase database)
|
||||
: base(database)
|
||||
{
|
||||
}
|
||||
|
||||
public IList<int> GetSeasonNumbers(int seriesId)
|
||||
{
|
||||
return Queryable.Where(c => c.SeriesId == seriesId).Select(c => c.SeasonNumber).ToList();
|
||||
}
|
||||
|
||||
public Season Get(int seriesId, int seasonNumber)
|
||||
{
|
||||
return Queryable.Single(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber);
|
||||
}
|
||||
|
||||
public bool IsIgnored(int seriesId, int seasonNumber)
|
||||
{
|
||||
return Queryable.Single(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).Ignored;
|
||||
}
|
||||
|
||||
public List<Season> GetSeasonBySeries(int seriesId)
|
||||
{
|
||||
return Queryable.Where(c => c.SeriesId == seriesId).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue