You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/NzbDrone.Core/Update/UpdateCheckService.cs

42 lines
1.2 KiB

using NLog;
using NzbDrone.Common.EnvironmentInfo;
11 years ago
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Instrumentation;
namespace NzbDrone.Core.Update
{
public interface ICheckUpdateService
{
UpdatePackage AvailableUpdate();
}
public class CheckUpdateService : ICheckUpdateService
{
private readonly IUpdatePackageProvider _updatePackageProvider;
11 years ago
private readonly IConfigFileProvider _configFileProvider;
private readonly Logger _logger;
11 years ago
public CheckUpdateService(IUpdatePackageProvider updatePackageProvider, IConfigFileProvider configFileProvider, Logger logger)
{
_updatePackageProvider = updatePackageProvider;
11 years ago
_configFileProvider = configFileProvider;
_logger = logger;
}
public UpdatePackage AvailableUpdate()
{
if (OsInfo.IsLinux) return null;
11 years ago
var latestAvailable = _updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version);
if (latestAvailable == null)
{
11 years ago
_logger.ProgressDebug("No update available.");
}
return latestAvailable;
}
}
}