|
|
@ -13,12 +13,15 @@ namespace NzbDrone.Core.Tv
|
|
|
|
public interface IEpisodeRepository : IBasicRepository<Episode>
|
|
|
|
public interface IEpisodeRepository : IBasicRepository<Episode>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Episode Get(int seriesId, int season, int episodeNumber);
|
|
|
|
Episode Get(int seriesId, int season, int episodeNumber);
|
|
|
|
|
|
|
|
Episode Find(int seriesId, int season, int episodeNumber);
|
|
|
|
Episode Get(int seriesId, DateTime date);
|
|
|
|
Episode Get(int seriesId, DateTime date);
|
|
|
|
|
|
|
|
Episode Find(int seriesId, DateTime date);
|
|
|
|
List<Episode> GetEpisodes(int seriesId);
|
|
|
|
List<Episode> GetEpisodes(int seriesId);
|
|
|
|
List<Episode> GetEpisodes(int seriesId, int seasonNumber);
|
|
|
|
List<Episode> GetEpisodes(int seriesId, int seasonNumber);
|
|
|
|
List<Episode> GetEpisodeByFileId(int fileId);
|
|
|
|
List<Episode> GetEpisodeByFileId(int fileId);
|
|
|
|
PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec, bool includeSpecials);
|
|
|
|
PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec, bool includeSpecials);
|
|
|
|
Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber);
|
|
|
|
Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber);
|
|
|
|
|
|
|
|
Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber);
|
|
|
|
List<Episode> EpisodesWithFiles();
|
|
|
|
List<Episode> EpisodesWithFiles();
|
|
|
|
List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate);
|
|
|
|
List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate);
|
|
|
|
void SetIgnoreFlat(Episode episode, bool ignoreFlag);
|
|
|
|
void SetIgnoreFlat(Episode episode, bool ignoreFlag);
|
|
|
@ -40,11 +43,21 @@ namespace NzbDrone.Core.Tv
|
|
|
|
return Query.Single(s => s.SeriesId == seriesId && s.SeasonNumber == season && s.EpisodeNumber == episodeNumber);
|
|
|
|
return Query.Single(s => s.SeriesId == seriesId && s.SeasonNumber == season && s.EpisodeNumber == episodeNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Episode Find(int seriesId, int season, int episodeNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == season && s.EpisodeNumber == episodeNumber);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Episode Get(int seriesId, DateTime date)
|
|
|
|
public Episode Get(int seriesId, DateTime date)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Query.Single(s => s.SeriesId == seriesId && s.AirDate.HasValue && s.AirDate.Value.Date == date.Date);
|
|
|
|
return Query.Single(s => s.SeriesId == seriesId && s.AirDate.HasValue && s.AirDate.Value.Date == date.Date);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Episode Find(int seriesId, DateTime date)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.AirDate.HasValue && s.AirDate.Value.Date == date.Date);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Episode> GetEpisodes(int seriesId)
|
|
|
|
public List<Episode> GetEpisodes(int seriesId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Query.Where(s => s.SeriesId == seriesId).ToList();
|
|
|
|
return Query.Where(s => s.SeriesId == seriesId).ToList();
|
|
|
@ -81,7 +94,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
pagingSpec.Records = pagingQuery.ToList();
|
|
|
|
pagingSpec.Records = pagingQuery.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Use the same query for count and records
|
|
|
|
//TODO: Use the same query for count and records
|
|
|
|
pagingSpec.TotalRecords = Query.Where(e => e.EpisodeFileId == 0 && e.SeasonNumber >= startingSeasonNumber && e.AirDate <= currentTime).Count();
|
|
|
|
pagingSpec.TotalRecords = Query.Count(e => e.EpisodeFileId == 0 && e.SeasonNumber >= startingSeasonNumber && e.AirDate <= currentTime);
|
|
|
|
|
|
|
|
|
|
|
|
return pagingSpec;
|
|
|
|
return pagingSpec;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -91,6 +104,11 @@ namespace NzbDrone.Core.Tv
|
|
|
|
return Query.Single(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
|
|
|
|
return Query.Single(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Episode> EpisodesWithFiles()
|
|
|
|
public List<Episode> EpisodesWithFiles()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Query.Where(s => s.EpisodeFileId != 0).ToList();
|
|
|
|
return Query.Where(s => s.EpisodeFileId != 0).ToList();
|
|
|
|