1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

moved update url from db to nzbdrone.config

This commit is contained in:
kay.one 2013-07-29 19:12:16 -07:00
parent 87bbf2dc6a
commit 2dfebd2147
8 changed files with 14 additions and 74 deletions

View File

@ -105,24 +105,6 @@ public void get_value_with_out_persist_should_not_store_default_value()
Subject.GetValue(key, value2).Should().Be(value2); 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] [Test]
public void updating_a_vakye_should_update_its_value() public void updating_a_vakye_should_update_its_value()
{ {

View File

@ -10,11 +10,11 @@ namespace NzbDrone.Core.Test.UpdateTests
public class UpdatePackageProviderFixture : CoreTest<UpdatePackageProvider> public class UpdatePackageProviderFixture : CoreTest<UpdatePackageProvider>
{ {
[Test] [Test]
public void should_get_list_of_avilable_updates() public void should_get_list_of_available_updates()
{ {
UseRealHttp(); 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(); var updates = Subject.GetAvailablePackages().ToList();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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