moved update url from db to nzbdrone.config

pull/25/head
kay.one 11 years ago
parent 87bbf2dc6a
commit 2dfebd2147

@ -105,24 +105,6 @@ namespace NzbDrone.Core.Test.Configuration
Subject.GetValue(key, value2).Should().Be(value2);
}
[Test]
public void uguid_should_only_be_set_once()
{
var guid1 = Subject.UGuid;
var guid2 = Subject.UGuid;
guid1.Should().Be(guid2);
}
[Test]
public void uguid_should_return_valid_result_on_first_call()
{
var guid = Subject.UGuid;
guid.Should().NotBeEmpty();
}
[Test]
public void updating_a_vakye_should_update_its_value()
{

@ -10,11 +10,11 @@ namespace NzbDrone.Core.Test.UpdateTests
public class UpdatePackageProviderFixture : CoreTest<UpdatePackageProvider>
{
[Test]
public void should_get_list_of_avilable_updates()
public void should_get_list_of_available_updates()
{
UseRealHttp();
Mocker.GetMock<IConfigService>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_release/");
Mocker.GetMock<IConfigFileProvider>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_release/");
var updates = Subject.GetAvailablePackages().ToList();

@ -22,6 +22,7 @@ namespace NzbDrone.Core.Configuration
string Username { get; }
string Password { get; }
string LogLevel { get; }
string UpdateUrl { get; }
}
public class ConfigFileProvider : IConfigFileProvider
@ -95,6 +96,11 @@ namespace NzbDrone.Core.Configuration
get { return GetValueBoolean("AuthenticationEnabled", false); }
}
public string UpdateUrl
{
get { return GetValue("UpdateUrl", "http://update.nzbdrone.com/vnext/"); }
}
public string Username
{
get { return GetValue("Username", ""); }

@ -5,7 +5,6 @@ using NLog;
using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.Instrumentation;
namespace NzbDrone.Core.Configuration
{
@ -137,11 +136,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("SeasonFolderFormat", value); }
}
public string UpdateUrl
{
get { return GetValue("UpdateUrl", "http://update.nzbdrone.com/vnext/"); }
set { SetValue("UpdateUrl", value); }
}
public bool AutoUnmonitorPreviouslyDownloadedEpisodes
{
@ -155,11 +149,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("Retention", value); }
}
public Guid UGuid
{
get { return Guid.Parse(GetValue("UGuid", Guid.NewGuid().ToString(), persist: true)); }
}
public DownloadClientType DownloadClient
{
get { return GetValueEnum("DownloadClient", DownloadClientType.Sabnzbd); }
@ -178,13 +167,6 @@ namespace NzbDrone.Core.Configuration
get { return "http://services.nzbdrone.com"; }
}
public Boolean MetadataUseBanners
{
get { return GetValueBoolean("MetadataUseBanners"); }
set { SetValue("MetadataUseBanners", value); }
}
public string PneumaticFolder
{
get { return GetValue("PneumaticFolder", String.Empty); }
@ -197,19 +179,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("RecycleBin", value); }
}
public int RssSyncInterval
{
get { return GetValueInt("RssSyncInterval", 15); }
set { SetValue("RssSyncInterval", value); }
}
public Boolean IgnoreArticlesWhenSortingSeries
{
get { return GetValueBoolean("IgnoreArticlesWhenSortingSeries", true); }
set { SetValue("IgnoreArticlesWhenSortingSeries", value); }
}
public String NzbgetUsername
{
get { return GetValue("NzbgetUsername", "nzbget"); }
@ -245,13 +214,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("NzbgetTvCategory", value); }
}
public Int32 NzbgetPriority
{
get { return GetValueInt("NzbgetPriority", 0); }
set { SetValue("NzbgetPriority", value); }
}
public PriorityType NzbgetRecentTvPriority
{
get { return GetValueEnum("NzbgetRecentTvPriority", PriorityType.Normal); }

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Common.Messaging;
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.Configuration.Events
{

@ -3,7 +3,6 @@ using System.Collections.Generic;
using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Download.Clients.Sabnzbd;
using NzbDrone.Core.Instrumentation;
namespace NzbDrone.Core.Configuration
{
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Configuration
{
IEnumerable<Config> All();
Dictionary<String, Object> AllWithDefaults();
string UpdateUrl { get; set; }
String SabHost { get; set; }
int SabPort { get; set; }
String SabApiKey { get; set; }
@ -25,26 +23,19 @@ namespace NzbDrone.Core.Configuration
string SeasonFolderFormat { get; set; }
bool AutoUnmonitorPreviouslyDownloadedEpisodes { get; set; }
int Retention { get; set; }
Guid UGuid { get; }
DownloadClientType DownloadClient { get; set; }
string BlackholeFolder { get; set; }
string ServiceRootUrl { get; }
Boolean MetadataUseBanners { get; set; }
string PneumaticFolder { get; set; }
string RecycleBin { get; set; }
int RssSyncInterval { get; set; }
Boolean IgnoreArticlesWhenSortingSeries { get; set; }
String NzbgetUsername { get; set; }
String NzbgetPassword { get; set; }
String NzbgetHost { get; set; }
Int32 NzbgetPort { get; set; }
String NzbgetTvCategory { get; set; }
Int32 NzbgetPriority { get; set; }
PriorityType NzbgetRecentTvPriority { get; set; }
PriorityType NzbgetOlderTvPriority { get; set; }
string ReleaseRestrictions { get; set; }
string GetValue(string key, object defaultValue, bool persist = false);
void SetValue(string key, string value);
void SaveValues(Dictionary<string, object> configValues);
}
}

@ -2,8 +2,10 @@
using System.IO;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Cache;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Update.Commands;
namespace NzbDrone.Core.Update
@ -33,6 +35,7 @@ namespace NzbDrone.Core.Update
_logger = logger;
}
public void Execute(ApplicationUpdateCommand message)
{
var latestAvailable = _checkUpdateService.AvailableUpdate();

@ -16,13 +16,13 @@ namespace NzbDrone.Core.Update
public class UpdatePackageProvider : IUpdatePackageProvider
{
private readonly IConfigService _configService;
private readonly IConfigFileProvider _configService;
private readonly IHttpProvider _httpProvider;
private readonly Logger _logger;
private static readonly Regex ParseRegex = new Regex(@"(?:\>)(?<filename>NzbDrone.+?(?<version>\d+\.\d+\.\d+\.\d+).+?)(?:\<\/A\>)", RegexOptions.IgnoreCase);
public UpdatePackageProvider(IConfigService configService, IHttpProvider httpProvider, Logger logger)
public UpdatePackageProvider(IConfigFileProvider configService, IHttpProvider httpProvider, Logger logger)
{
_configService = configService;
_httpProvider = httpProvider;

Loading…
Cancel
Save