Fixed: Adjust Sonarr references to Radarr (#1977)

pull/1978/merge
James White 7 years ago committed by Leonardo Galli
parent 685c5daf36
commit 38af8edd59

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -108,7 +108,7 @@ namespace NzbDrone.Common.Disk
} }
} }
} }
public bool CanUseGDIPlus() public bool CanUseGDIPlus()
{ {
try try
@ -129,7 +129,7 @@ namespace NzbDrone.Common.Disk
{ {
return true; return true;
} }
try try
{ {
using (var bmp = new Bitmap(filename)) using (var bmp = new Bitmap(filename))
@ -150,7 +150,7 @@ namespace NzbDrone.Common.Disk
try try
{ {
var testPath = Path.Combine(path, "sonarr_write_test.txt"); var testPath = Path.Combine(path, "radarr_write_test.txt");
var testContent = string.Format("This file was created to verify if '{0}' is writable. It should've been automatically deleted. Feel free to delete it.", path); var testContent = string.Format("This file was created to verify if '{0}' is writable. It should've been automatically deleted. Feel free to delete it.", path);
File.WriteAllText(testPath, testContent); File.WriteAllText(testPath, testContent);
File.Delete(testPath); File.Delete(testPath);

@ -136,7 +136,7 @@ namespace NzbDrone.Common.Http.Dispatchers
webRequest.TransferEncoding = header.Value; webRequest.TransferEncoding = header.Value;
break; break;
case "User-Agent": case "User-Agent":
throw new NotSupportedException("User-Agent other than Sonarr not allowed."); throw new NotSupportedException("User-Agent other than Radarr not allowed.");
case "Proxy-Connection": case "Proxy-Connection":
throw new NotImplementedException(); throw new NotImplementedException();
default: default:

@ -1,4 +1,4 @@
using System; using System;
using System.Net; using System.Net;
using NLog; using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
@ -24,7 +24,7 @@ namespace NzbDrone.Common.Http
public HttpProvider(Logger logger) public HttpProvider(Logger logger)
{ {
_logger = logger; _logger = logger;
_userAgent = string.Format("Sonarr {0}", BuildInfo.Version); _userAgent = string.Format("Radarr {0}", BuildInfo.Version);
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
} }
@ -58,6 +58,6 @@ namespace NzbDrone.Common.Http
} }
} }
} }
} }

@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
protected void GivenRedirectToTorrent() protected void GivenRedirectToTorrent()
{ {
var httpHeader = new HttpHeader(); var httpHeader = new HttpHeader();
httpHeader["Location"] = "http://test.sonarr.tv/not-a-real-torrent.torrent"; httpHeader["Location"] = "http://test.radarr.video/not-a-real-torrent.torrent";
Mocker.GetMock<IHttpClient>() Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl))) .Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl)))
@ -405,7 +405,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
[Test] [Test]
public void should_get_category_from_the_category_if_set() public void should_get_category_from_the_category_if_set()
{ {
const string category = "tv-sonarr"; const string category = "movies-radarr";
GivenMaxRatio(1.0f); GivenMaxRatio(1.0f);
var torrent = new QBittorrentTorrent var torrent = new QBittorrentTorrent
@ -430,7 +430,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
[Test] [Test]
public void should_get_category_from_the_label_if_the_category_is_not_available() public void should_get_category_from_the_label_if_the_category_is_not_available()
{ {
const string category = "tv-sonarr"; const string category = "movies-radarr";
GivenMaxRatio(1.0f); GivenMaxRatio(1.0f);
var torrent = new QBittorrentTorrent var torrent = new QBittorrentTorrent

@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
protected void GivenRedirectToTorrent() protected void GivenRedirectToTorrent()
{ {
var httpHeader = new HttpHeader(); var httpHeader = new HttpHeader();
httpHeader["Location"] = "http://test.sonarr.tv/not-a-real-torrent.torrent"; httpHeader["Location"] = "http://test.radarr.video/not-a-real-torrent.torrent";
Mocker.GetMock<IHttpClient>() Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.ToString() == _downloadUrl))) .Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.ToString() == _downloadUrl)))

@ -1,4 +1,4 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using FluentValidation; using FluentValidation;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
[FieldDefinition(3, Label = "Password", Type = FieldType.Password)] [FieldDefinition(3, Label = "Password", Type = FieldType.Password)]
public string Password { get; set; } public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Sonarr avoids conflicts with unrelated downloads, but it's optional. Creates a [category] subdirectory in the output directory.")] [FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Radarr avoids conflicts with unrelated downloads, but it's optional. Creates a [category] subdirectory in the output directory.")]
public string TvCategory { get; set; } public string TvCategory { get; set; }
[FieldDefinition(5, Label = "Directory", Type = FieldType.Textbox, HelpText = "Optional shared folder to put downloads into, leave blank to use the default Download Station location")] [FieldDefinition(5, Label = "Directory", Type = FieldType.Textbox, HelpText = "Optional shared folder to put downloads into, leave blank to use the default Download Station location")]

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -345,7 +345,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
_logger.Error(ex, ex.Message); _logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure("Username", "Authentication failure") return new NzbDroneValidationFailure("Username", "Authentication failure")
{ {
DetailedDescription = $"Please verify your username and password. Also verify if the host running Sonarr isn't blocked from accessing {Name} by WhiteList limitations in the {Name} configuration." DetailedDescription = $"Please verify your username and password. Also verify if the host running Radarr isn't blocked from accessing {Name} by WhiteList limitations in the {Name} configuration."
}; };
} }
catch (WebException ex) catch (WebException ex)

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -259,7 +259,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
_logger.Error(ex, ex.Message); _logger.Error(ex, ex.Message);
return new NzbDroneValidationFailure("Username", "Authentication failure") return new NzbDroneValidationFailure("Username", "Authentication failure")
{ {
DetailedDescription = $"Please verify your username and password. Also verify if the host running Sonarr isn't blocked from accessing {Name} by WhiteList limitations in the {Name} configuration." DetailedDescription = $"Please verify your username and password. Also verify if the host running Radarr isn't blocked from accessing {Name} by WhiteList limitations in the {Name} configuration."
}; };
} }
catch (WebException ex) catch (WebException ex)

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Indexers.Newznab
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Debug(ex, "Failed to get newznab api capabilities from {0}", indexerSettings.BaseUrl); _logger.Debug(ex, "Failed to get Newznab API capabilities from {0}", indexerSettings.BaseUrl);
throw; throw;
} }
@ -74,7 +74,7 @@ namespace NzbDrone.Core.Indexers.Newznab
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Failed to determine newznab api capabilities for {0}, using the defaults instead till Sonarr restarts.", indexerSettings.BaseUrl); _logger.Error(ex, "Failed to determine newznab api capabilities for {0}, using the defaults instead till Radarr restarts.", indexerSettings.BaseUrl);
} }
return capabilities; return capabilities;

@ -1,4 +1,4 @@
using FluentValidation.Results; using FluentValidation.Results;
using Growl.Connector; using Growl.Connector;
using Growl.CoreLibrary; using Growl.CoreLibrary;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
@ -102,7 +102,7 @@ namespace NzbDrone.Core.Notifications.Growl
private void Register(string host, int port, string password) private void Register(string host, int port, string password)
{ {
_logger.Debug("Registering Sonarr with Growl host: {0}:{1}", host, port); _logger.Debug("Registering Radarr with Growl host: {0}:{1}", host, port);
var growlConnector = GetGrowlConnector(host, port, password); var growlConnector = GetGrowlConnector(host, port, password);

@ -1,4 +1,4 @@
using System; using System;
using System.Net; using System.Net;
using FluentValidation.Results; using FluentValidation.Results;
using NLog; using NLog;
@ -49,13 +49,13 @@ namespace NzbDrone.Core.Notifications.MediaBrowser
{ {
_logger.Debug("Testing connection to MediaBrowser: {0}", settings.Address); _logger.Debug("Testing connection to MediaBrowser: {0}", settings.Address);
Notify(settings, "Test from Sonarr", "Success! MediaBrowser has been successfully configured!"); Notify(settings, "Test from Radarr", "Success! MediaBrowser has been successfully configured!");
} }
catch (RestException ex) catch (RestException ex)
{ {
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{ {
return new ValidationFailure("ApiKey", "API Key is incorrect"); return new ValidationFailure("ApiKey", "API key is incorrect");
} }
} }
catch (Exception ex) catch (Exception ex)

@ -1,4 +1,4 @@
using RestSharp; using RestSharp;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Core.Rest namespace NzbDrone.Core.Rest
@ -9,7 +9,7 @@ namespace NzbDrone.Core.Rest
{ {
var restClient = new RestClient(baseUrl); var restClient = new RestClient(baseUrl);
restClient.UserAgent = string.Format("Sonarr/{0} (RestSharp/{1}; {2}/{3})", restClient.UserAgent = string.Format("Radarr/{0} (RestSharp/{1}; {2}/{3})",
BuildInfo.Version, BuildInfo.Version,
restClient.GetType().Assembly.GetName().Version, restClient.GetType().Assembly.GetName().Version,
OsInfo.Os, OsInfo.Version.ToString(2)); OsInfo.Os, OsInfo.Version.ToString(2));

@ -1,4 +1,4 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using FluentValidation; using FluentValidation;
using FluentValidation.Validators; using FluentValidation.Validators;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
@ -36,7 +36,7 @@ namespace NzbDrone.Core.Validation
public static IRuleBuilderOptions<T, string> ValidUrlBase<T>(this IRuleBuilder<T, string> ruleBuilder) public static IRuleBuilderOptions<T, string> ValidUrlBase<T>(this IRuleBuilder<T, string> ruleBuilder)
{ {
return ruleBuilder.SetValidator(new RegularExpressionValidator(@"^(?!\/?https?://[-_a-z0-9.]+)", RegexOptions.IgnoreCase)).WithMessage("Must be a valid URL path (ie: '/sonarr')"); return ruleBuilder.SetValidator(new RegularExpressionValidator(@"^(?!\/?https?://[-_a-z0-9.]+)", RegexOptions.IgnoreCase)).WithMessage("Must be a valid URL path (ie: '/radarr')");
} }
public static IRuleBuilderOptions<T, int> ValidPort<T>(this IRuleBuilder<T, int> ruleBuilder) public static IRuleBuilderOptions<T, int> ValidPort<T>(this IRuleBuilder<T, int> ruleBuilder)
@ -68,4 +68,4 @@ namespace NzbDrone.Core.Validation
return ruleBuilder.WithState(v => NzbDroneValidationState.Warning); return ruleBuilder.WithState(v => NzbDroneValidationState.Warning);
} }
} }
} }

@ -15,7 +15,7 @@ namespace NzbDrone.Integration.Test
config.LogLevel = "Trace"; config.LogLevel = "Trace";
HostConfig.Put(config); HostConfig.Put(config);
var logFile = Path.Combine(_runner.AppData, "logs", "sonarr.trace.txt"); var logFile = Path.Combine(_runner.AppData, "logs", "radarr.trace.txt");
var logLines = File.ReadAllLines(logFile); var logLines = File.ReadAllLines(logFile);
var result = Series.InvalidPost(new Api.Series.SeriesResource()); var result = Series.InvalidPost(new Api.Series.SeriesResource());

Loading…
Cancel
Save