mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-01 07:55:22 +02:00
UpcomingEpisodesProvider moved to PetaPoco.
MigrationHelper won't run Subsonic Migrations now.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user