mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
UpcomingEpisodesProvider moved to PetaPoco.
MigrationHelper won't run Subsonic Migrations now.
This commit is contained in:
parent
446a939f45
commit
335639fabc
4 changed files with 163 additions and 13 deletions
|
@ -4,25 +4,25 @@ using System.Linq;
|
|||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository;
|
||||
using PetaPoco;
|
||||
using SubSonic.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class UpcomingEpisodesProvider
|
||||
{
|
||||
private readonly IRepository _repository;
|
||||
private readonly IDatabase _database;
|
||||
|
||||
[Inject]
|
||||
public UpcomingEpisodesProvider(IRepository repository)
|
||||
public UpcomingEpisodesProvider(IDatabase database)
|
||||
{
|
||||
_repository = repository;
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public virtual UpcomingEpisodesModel Upcoming()
|
||||
{
|
||||
var allEps =
|
||||
_repository.All<Episode>().Where(
|
||||
e => e.AirDate >= DateTime.Today.AddDays(-1) && e.AirDate < DateTime.Today.AddDays(8));
|
||||
var allEps = _database.Fetch<Episode>("WHERE AirDate BETWEEN @0 AND @1", DateTime.Today.AddDays(-1),
|
||||
DateTime.Today.AddDays(8));
|
||||
|
||||
var yesterday = allEps.Where(e => e.AirDate == DateTime.Today.AddDays(-1)).ToList();
|
||||
var today = allEps.Where(e => e.AirDate == DateTime.Today).ToList();
|
||||
|
@ -33,24 +33,22 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
public virtual List<Episode> Yesterday()
|
||||
{
|
||||
return _repository.All<Episode>().Where(e => e.AirDate == DateTime.Today.AddDays(-1)).ToList();
|
||||
return _database.Fetch<Episode>("WHERE AirDate = @0", DateTime.Today.AddDays(-1));
|
||||
}
|
||||
|
||||
public virtual List<Episode> Today()
|
||||
{
|
||||
return _repository.All<Episode>().Where(e => e.AirDate == DateTime.Today).ToList();
|
||||
return _database.Fetch<Episode>("WHERE AirDate = @0", DateTime.Today);
|
||||
}
|
||||
|
||||
public virtual List<Episode> Tomorrow()
|
||||
{
|
||||
return _repository.All<Episode>().Where(e => e.AirDate == DateTime.Today.AddDays(1)).ToList();
|
||||
return _database.Fetch<Episode>("WHERE AirDate = @0", DateTime.Today.AddDays(1));
|
||||
}
|
||||
|
||||
public virtual List<Episode> Week()
|
||||
{
|
||||
return
|
||||
_repository.All<Episode>().Where(e => e.AirDate > DateTime.Today.AddDays(1) && e.AirDate < DateTime.Today.AddDays(8))
|
||||
.ToList();
|
||||
return _database.Fetch<Episode>("WHERE AirDate BETWEEN @0 AND @1", DateTime.Today.AddDays(2), DateTime.Today.AddDays(8));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue