mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
More config pages have been added. AJAX to save. Order with jquery sortable.
Some RssFeed Parsing has been implemented, it does not currently download items, still need to perform a more verbose episode check.
This commit is contained in:
parent
65ecd58111
commit
da979639ba
145 changed files with 8384 additions and 113 deletions
62
NzbDrone.Core/Providers/HistoryProvider.cs
Normal file
62
NzbDrone.Core/Providers/HistoryProvider.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using SubSonic.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class HistoryProvider : IHistoryProvider
|
||||
{
|
||||
private readonly IRepository _sonicRepo;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public HistoryProvider(IRepository sonicRepo)
|
||||
{
|
||||
_sonicRepo = sonicRepo;
|
||||
}
|
||||
|
||||
#region IHistoryProvider Members
|
||||
|
||||
public List<History> AllItems()
|
||||
{
|
||||
return _sonicRepo.All<History>().ToList();
|
||||
}
|
||||
|
||||
public void Purge()
|
||||
{
|
||||
var all = _sonicRepo.All<History>();
|
||||
_sonicRepo.DeleteMany(all);
|
||||
Logger.Info("History has been Purged");
|
||||
}
|
||||
|
||||
public void Trim()
|
||||
{
|
||||
var old = _sonicRepo.All<History>().Where(h => h.Date < DateTime.Now.AddDays(-30));
|
||||
_sonicRepo.DeleteMany(old);
|
||||
Logger.Info("History has been trimmed, items older than 30 days have been removed");
|
||||
}
|
||||
|
||||
public void Insert(History item)
|
||||
{
|
||||
_sonicRepo.Add(item);
|
||||
Logger.Info("Item added to history: {0} - {1}x{2:00}", item.Episode.Series.Title, item.Episode.SeasonNumber, item.Episode.EpisodeNumber);
|
||||
}
|
||||
|
||||
public bool Exists(int episodeId, QualityTypes quality, bool proper)
|
||||
{
|
||||
//Looks for the existance of this episode in History
|
||||
if (_sonicRepo.Exists<History>(h => h.EpisodeId == episodeId && (QualityTypes)h.Quality == quality && h.IsProper == proper))
|
||||
return true;
|
||||
|
||||
Logger.Debug("Episode not in History: {0}", episodeId);
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue