Initial Commit Rework

This commit is contained in:
Qstick 2017-09-03 22:20:56 -04:00
parent 74a4cc048c
commit 95051cbd63
2483 changed files with 101351 additions and 111396 deletions

View file

@ -0,0 +1,46 @@
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Update;
using Lidarr.Http;
namespace Lidarr.Api.V3.Update
{
public class UpdateModule : LidarrRestModule<UpdateResource>
{
private readonly IRecentUpdateProvider _recentUpdateProvider;
public UpdateModule(IRecentUpdateProvider recentUpdateProvider)
{
_recentUpdateProvider = recentUpdateProvider;
GetResourceAll = GetRecentUpdates;
}
private List<UpdateResource> GetRecentUpdates()
{
var resources = _recentUpdateProvider.GetRecentUpdatePackages()
.OrderByDescending(u => u.Version)
.ToResource();
if (resources.Any())
{
var first = resources.First();
first.Latest = true;
if (first.Version > BuildInfo.Version)
{
first.Installable = true;
}
var installed = resources.SingleOrDefault(r => r.Version == BuildInfo.Version);
if (installed != null)
{
installed.Installed = true;
}
}
return resources;
}
}
}