mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-13 15:34:28 -04:00
Compare commits
57 Commits
v2.0.0.491
...
dsm-sid-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c16eddbf9f | ||
|
|
0236f6595b | ||
|
|
eea342980e | ||
|
|
13a9703eaa | ||
|
|
58423d4b32 | ||
|
|
6444565bf4 | ||
|
|
46ff40a97e | ||
|
|
174b00f188 | ||
|
|
4e74fe2eec | ||
|
|
e042388a97 | ||
|
|
2b8ab92ef7 | ||
|
|
7b7f48a0e3 | ||
|
|
714ce2640b | ||
|
|
7c5daa6000 | ||
|
|
ea7d7d0a14 | ||
|
|
8bc55c5305 | ||
|
|
50b01d8d00 | ||
|
|
9c1d275403 | ||
|
|
5372ed5d40 | ||
|
|
6626397350 | ||
|
|
ef8b882258 | ||
|
|
728f553802 | ||
|
|
bc32ad064e | ||
|
|
56825da6b6 | ||
|
|
17ff52ada1 | ||
|
|
bbd38dec29 | ||
|
|
77cdb542b6 | ||
|
|
52ce2c0007 | ||
|
|
58d158a5dc | ||
|
|
de5d120aac | ||
|
|
19a4d3536b | ||
|
|
bea4954de9 | ||
|
|
810701ad52 | ||
|
|
f3bf50e8d7 | ||
|
|
fa34af8f15 | ||
|
|
9a82f45020 | ||
|
|
7d21585f50 | ||
|
|
51d08fd8e8 | ||
|
|
078b53dc13 | ||
|
|
b8b0f05920 | ||
|
|
b8001943b4 | ||
|
|
c70740e3b6 | ||
|
|
35f911286f | ||
|
|
650f01176c | ||
|
|
2246dfab05 | ||
|
|
6bfb790eb8 | ||
|
|
0e85e39815 | ||
|
|
9471343533 | ||
|
|
2d1d1c8a99 | ||
|
|
7e5e136930 | ||
|
|
c659ba1c10 | ||
|
|
caf7a8c69e | ||
|
|
40e5626ddb | ||
|
|
1b9ccc319f | ||
|
|
89e804814b | ||
|
|
ce6a5713d1 | ||
|
|
ba01b636b9 |
@@ -1,3 +1,3 @@
|
||||
#SET BUILD_NUMBER=1
|
||||
#SET branch=develop
|
||||
REM SET BUILD_NUMBER=1
|
||||
REM SET branch=develop
|
||||
inno\ISCC.exe nzbdrone.iss
|
||||
@@ -40,8 +40,11 @@ VersionInfoVersion={#BuildNumber}
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
;Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
Name: "windowsService"; Description: "Install as a Windows Service"
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"
|
||||
Name: "windowsService"; Description: "Install Windows Service (Starts when the computer starts)"; GroupDescription: "Start automatically"; Flags: exclusive
|
||||
Name: "startupShortcut"; Description: "Create shortcut in Startup folder (Starts when you log into Windows)"; GroupDescription: "Start automatically"; Flags: exclusive unchecked
|
||||
Name: "none"; Description: "Do not start automatically"; GroupDescription: "Start automatically"; Flags: exclusive unchecked
|
||||
|
||||
|
||||
[Files]
|
||||
Source: "..\_output\NzbDrone.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
@@ -51,10 +54,13 @@ Source: "..\_output\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs cr
|
||||
[Icons]
|
||||
Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Parameters: "/icon"
|
||||
Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Parameters: "/icon"
|
||||
Name: "{userstartup}\{#AppName}"; Filename: "{app}\NzbDrone.exe"; WorkingDir: "{app}"; Tasks: startupShortcut
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\nzbdrone.console.exe"; Parameters: "/u"; Flags: waituntilterminated;
|
||||
Filename: "{app}\nzbdrone.console.exe"; Parameters: "/i"; Flags: waituntilterminated; Tasks: windowsService
|
||||
Filename: "{app}\nzbdrone.console.exe"; Parameters: "/u"; Flags: runhidden waituntilterminated;
|
||||
Filename: "{app}\nzbdrone.console.exe"; Parameters: "/i"; Flags: runhidden waituntilterminated; Tasks: windowsService
|
||||
Filename: "{app}\NzbDrone.exe"; Description: "Open Sonarr"; Flags: postinstall skipifsilent nowait; Tasks: windowsService;
|
||||
Filename: "{app}\NzbDrone.exe"; Description: "Start Sonarr"; Flags: postinstall skipifsilent nowait; Tasks: startupShortcut none;
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "{app}\nzbdrone.console.exe"; Parameters: "/u"; Flags: waituntilterminated skipifdoesntexist
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
using Nancy;
|
||||
@@ -21,10 +21,7 @@ namespace NzbDrone.Api.Frontend.Mappers
|
||||
_diskProvider = diskProvider;
|
||||
_logger = logger;
|
||||
|
||||
if (!RuntimeInfo.IsProduction)
|
||||
{
|
||||
_caseSensitive = StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
_caseSensitive = RuntimeInfo.IsProduction ? DiskProviderBase.PathStringComparison : StringComparison.OrdinalIgnoreCase;
|
||||
}
|
||||
|
||||
public abstract string Map(string resourceUrl);
|
||||
@@ -50,6 +47,5 @@ namespace NzbDrone.Api.Frontend.Mappers
|
||||
{
|
||||
return File.OpenRead(filePath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using NzbDrone.Api.Episodes;
|
||||
using NzbDrone.Api.Series;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
namespace NzbDrone.Api.Parse
|
||||
@@ -18,7 +19,8 @@ namespace NzbDrone.Api.Parse
|
||||
private ParseResource Parse()
|
||||
{
|
||||
var title = Request.Query.Title.Value as string;
|
||||
var parsedEpisodeInfo = Parser.ParseTitle(title);
|
||||
var path = Request.Query.Path.Value as string;
|
||||
var parsedEpisodeInfo = path.IsNotNullOrWhiteSpace() ? Parser.ParsePath(path) : Parser.ParseTitle(title);
|
||||
|
||||
if (parsedEpisodeInfo == null)
|
||||
{
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace NzbDrone.Api.System.Backup
|
||||
|
||||
return backups.Select(b => new BackupResource
|
||||
{
|
||||
Id = b.Path.GetHashCode(),
|
||||
Name = Path.GetFileName(b.Path),
|
||||
Path = b.Path,
|
||||
Id = b.Name.GetHashCode(),
|
||||
Name = b.Name,
|
||||
Path = $"/backup/{b.Type.ToString().ToLower()}/{b.Name}",
|
||||
Type = b.Type,
|
||||
Time = b.Time
|
||||
}).ToList();
|
||||
|
||||
@@ -139,11 +139,26 @@ namespace NzbDrone.Common.Test.Http
|
||||
var request = new HttpRequest($"http://{_httpBinHost}/redirect/1");
|
||||
request.AllowAutoRedirect = true;
|
||||
|
||||
Subject.Get(request);
|
||||
var response = Subject.Get(request);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
|
||||
ExceptionVerification.ExpectedErrors(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_follow_redirects()
|
||||
{
|
||||
var request = new HttpRequest($"http://{_httpBinHost}/redirect/1");
|
||||
request.AllowAutoRedirect = false;
|
||||
|
||||
var response = Subject.Get(request);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Found);
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_follow_redirects_to_https()
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace NzbDrone.Common.Test.InstrumentationTests
|
||||
[TestCase(@"https://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=sonarr&api=mySecret&eng=1")]
|
||||
[TestCase(@"https://dognzb.cr/fetch/2b51db35e1912ffc138825a12b9933d2/2b51db35e1910123321025a12b9933d2")]
|
||||
[TestCase(@"https://baconbits.org/feeds.php?feed=torrents_tv&user=12345&auth=2b51db35e1910123321025a12b9933d2&passkey=mySecret&authkey=2b51db35e1910123321025a12b9933d2")]
|
||||
[TestCase(@"http://127.0.0.1:9117/dl/indexername?jackett_apikey=flwjiefewklfjacketmySecretsdfldskjfsdlk&path=we0re9f0sdfbase64sfdkfjsdlfjk&file=The+Torrent+File+Name.torrent")]
|
||||
// NzbGet
|
||||
[TestCase(@"{ ""Name"" : ""ControlUsername"", ""Value"" : ""mySecret"" }, { ""Name"" : ""ControlPassword"", ""Value"" : ""mySecret"" }, ")]
|
||||
[TestCase(@"{ ""Name"" : ""Server1.Username"", ""Value"" : ""mySecret"" }, { ""Name"" : ""Server1.Password"", ""Value"" : ""mySecret"" }, ")]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
@@ -24,6 +24,8 @@ namespace NzbDrone.Common
|
||||
Console.WriteLine(" /{0} Install the application as a Windows Service ({1}).", StartupContext.INSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME);
|
||||
Console.WriteLine(" /{0} Uninstall already installed Windows Service ({1}).", StartupContext.UNINSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME);
|
||||
Console.WriteLine(" /{0} Don't open Sonarr in a browser", StartupContext.NO_BROWSER);
|
||||
Console.WriteLine(" /{0} Start Sonarr terminating any other instances", StartupContext.TERMINATE);
|
||||
Console.WriteLine(" /{0}=path Path to use as the AppData location (stores database, config, logs, etc)", StartupContext.APPDATA);
|
||||
Console.WriteLine(" <No Arguments> Run application in console mode.");
|
||||
}
|
||||
|
||||
@@ -37,4 +39,4 @@ namespace NzbDrone.Common
|
||||
Console.WriteLine("Can't find service ({0})", ServiceProvider.NZBDRONE_SERVICE_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace NzbDrone.Common.Disk
|
||||
{
|
||||
get
|
||||
{
|
||||
if (VolumeLabel.IsNullOrWhiteSpace())
|
||||
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID=") || Name == VolumeLabel)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System;
|
||||
|
||||
namespace NzbDrone.Common.EnvironmentInfo
|
||||
{
|
||||
public interface IRuntimeInfo
|
||||
@@ -7,8 +5,9 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||
bool IsUserInteractive { get; }
|
||||
bool IsAdmin { get; }
|
||||
bool IsWindowsService { get; }
|
||||
bool IsWindowsTray { get; }
|
||||
bool IsExiting { get; set; }
|
||||
bool RestartPending { get; set; }
|
||||
string ExecutingApplication { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Security.Principal;
|
||||
using System.ServiceProcess;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Processes;
|
||||
|
||||
namespace NzbDrone.Common.EnvironmentInfo
|
||||
{
|
||||
@@ -27,6 +28,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||
if (entry != null)
|
||||
{
|
||||
ExecutingApplication = entry.Location;
|
||||
IsWindowsTray = entry.ManifestModule.Name == $"{ProcessProvider.NZB_DRONE_PROCESS_NAME}.exe";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,5 +104,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsWindowsTray { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,18 +34,11 @@ namespace NzbDrone.Common.Http.Dispatchers
|
||||
{
|
||||
return _managedDispatcher.GetResponse(request, cookies);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (TlsFailureException)
|
||||
{
|
||||
if (ex.ToString().Contains("The authentication or decryption has failed."))
|
||||
{
|
||||
_logger.Debug("https request failed in tls error for {0}, trying curl fallback.", request.Url.Host);
|
||||
_logger.Debug("https request failed in tls error for {0}, trying curl fallback.", request.Url.Host);
|
||||
|
||||
_curlTLSFallbackCache.Set(request.Url.Host, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
_curlTLSFallbackCache.Set(request.Url.Host, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace NzbDrone.Common.Http.Dispatchers
|
||||
AddRequestHeaders(webRequest, request.Headers);
|
||||
}
|
||||
|
||||
if (request.ContentData != null)
|
||||
{
|
||||
webRequest.ContentLength = request.ContentData.Length;
|
||||
using (var writeStream = webRequest.GetRequestStream())
|
||||
{
|
||||
writeStream.Write(request.ContentData, 0, request.ContentData.Length);
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebResponse httpWebResponse;
|
||||
|
||||
try
|
||||
{
|
||||
if (request.ContentData != null)
|
||||
{
|
||||
webRequest.ContentLength = request.ContentData.Length;
|
||||
using (var writeStream = webRequest.GetRequestStream())
|
||||
{
|
||||
writeStream.Write(request.ContentData, 0, request.ContentData.Length);
|
||||
}
|
||||
}
|
||||
|
||||
httpWebResponse = (HttpWebResponse)webRequest.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
@@ -78,9 +78,17 @@ namespace NzbDrone.Common.Http.Dispatchers
|
||||
{
|
||||
throw new WebException($"DNS Name Resolution Failure: '{webRequest.RequestUri.Host}'", e.Status);
|
||||
}
|
||||
else if (e.ToString().Contains("TLS Support not"))
|
||||
{
|
||||
throw new TlsFailureException(webRequest, e);
|
||||
}
|
||||
else if (e.ToString().Contains("The authentication or decryption has failed."))
|
||||
{
|
||||
throw new TlsFailureException(webRequest, e);
|
||||
}
|
||||
else if (OsInfo.IsNotWindows)
|
||||
{
|
||||
throw new WebException($"{e.Message}: '{webRequest.RequestUri}'", e.Status);
|
||||
throw new WebException($"{e.Message}: '{webRequest.RequestUri}'", e, e.Status, e.Response);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -52,36 +52,33 @@ namespace NzbDrone.Common.Http
|
||||
|
||||
public HttpResponse Execute(HttpRequest request)
|
||||
{
|
||||
var autoRedirectCount = 0;
|
||||
var autoRedirectChain = new List<string>();
|
||||
autoRedirectChain.Add(request.Url.ToString());
|
||||
|
||||
var response = ExecuteRequest(request);
|
||||
|
||||
while (response.StatusCode == HttpStatusCode.Moved ||
|
||||
response.StatusCode == HttpStatusCode.MovedPermanently ||
|
||||
response.StatusCode == HttpStatusCode.Found)
|
||||
if (request.AllowAutoRedirect && response.HasHttpRedirect)
|
||||
{
|
||||
if (request.AllowAutoRedirect)
|
||||
var autoRedirectChain = new List<string>();
|
||||
autoRedirectChain.Add(request.Url.ToString());
|
||||
|
||||
do
|
||||
{
|
||||
request.Url += new HttpUri(response.Headers.GetSingleValue("Location"));
|
||||
autoRedirectChain.Add(request.Url.ToString());
|
||||
|
||||
_logger.Trace("Redirected to {0}", request.Url);
|
||||
|
||||
autoRedirectCount++;
|
||||
if (autoRedirectCount > 3)
|
||||
if (autoRedirectChain.Count > 3)
|
||||
{
|
||||
throw new WebException($"Too many automatic redirections were attempted for {autoRedirectChain.Join(" -> ")}", WebExceptionStatus.ProtocolError);
|
||||
}
|
||||
|
||||
response = ExecuteRequest(request);
|
||||
}
|
||||
else if (!RuntimeInfo.IsProduction)
|
||||
{
|
||||
_logger.Error("Server requested a redirect to [{0}]. Update the request URL to avoid this redirect.", response.Headers["Location"]);
|
||||
break;
|
||||
}
|
||||
while (response.HasHttpRedirect);
|
||||
}
|
||||
|
||||
if (response.HasHttpRedirect && !RuntimeInfo.IsProduction)
|
||||
{
|
||||
_logger.Error("Server requested a redirect to [{0}] while in developer mode. Update the request URL to avoid this redirect.", response.Headers["Location"]);
|
||||
}
|
||||
|
||||
if (!request.SuppressHttpError && response.HasHttpError)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace NzbDrone.Common.Http
|
||||
|
||||
private string _content;
|
||||
|
||||
public string Content
|
||||
public string Content
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -51,6 +51,10 @@ namespace NzbDrone.Common.Http
|
||||
|
||||
public bool HasHttpError => (int)StatusCode >= 400;
|
||||
|
||||
public bool HasHttpRedirect => StatusCode == HttpStatusCode.Moved ||
|
||||
StatusCode == HttpStatusCode.MovedPermanently ||
|
||||
StatusCode == HttpStatusCode.Found;
|
||||
|
||||
public Dictionary<string, string> GetCookies()
|
||||
{
|
||||
var result = new Dictionary<string, string>();
|
||||
@@ -95,4 +99,4 @@ namespace NzbDrone.Common.Http
|
||||
|
||||
public T Resource { get; private set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
src/NzbDrone.Common/Http/TlsFailureException.cs
Normal file
18
src/NzbDrone.Common/Http/TlsFailureException.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Common.Http
|
||||
{
|
||||
public class TlsFailureException : WebException
|
||||
{
|
||||
public TlsFailureException(WebRequest request, WebException innerException)
|
||||
: base("Failed to establish secure https connection to '" + request.RequestUri + "', libcurl fallback might be unavailable.", innerException, WebExceptionStatus.SecureChannelFailure, innerException.Response)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ namespace NzbDrone.Common.Instrumentation
|
||||
{
|
||||
public class CleanseLogMessage
|
||||
{
|
||||
private static readonly Regex[] CleansingRules = new[]
|
||||
private static readonly Regex[] CleansingRules = new[]
|
||||
{
|
||||
// Url
|
||||
new Regex(@"(?<=\?|&)(apikey|token|passkey|auth|authkey|user|uid|api)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||
new Regex(@"(?<=\?|&)(apikey|token|passkey|auth|authkey|user|uid|api|[a-z_]*apikey)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||
new Regex(@"(?<=\?|&)[^=]*?(username|password)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||
new Regex(@"torrentleech\.org/(?!rss)(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||
new Regex(@"torrentleech\.org/rss/download/[0-9]+/(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||
|
||||
@@ -172,6 +172,7 @@
|
||||
<Compile Include="Http\HttpRequestBuilder.cs" />
|
||||
<Compile Include="Http\HttpRequestBuilderFactory.cs" />
|
||||
<Compile Include="Http\Proxy\ProxyType.cs" />
|
||||
<Compile Include="Http\TlsFailureException.cs" />
|
||||
<Compile Include="Http\TooManyRequestsException.cs" />
|
||||
<Compile Include="Extensions\IEnumerableExtensions.cs" />
|
||||
<Compile Include="Http\UserAgentBuilder.cs" />
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Net;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
|
||||
namespace NzbDrone.Common.Security
|
||||
@@ -19,11 +18,6 @@ namespace NzbDrone.Common.Security
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
// This was never meant to be used on mono, and will cause issues with mono 5 and higher if btls is enabled.
|
||||
// Instead, force TLS provider to legacy for now due to conflict between btls and mediainfo, unless the user explicitly specified it.
|
||||
if (Environment.GetEnvironmentVariable("MONO_TLS_PROVIDER").IsNullOrWhiteSpace())
|
||||
{
|
||||
Environment.SetEnvironmentVariable("MONO_TLS_PROVIDER", "legacy");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
|
||||
.Verify(v => v.GetSceneTvdbMappings(10), Times.Never());
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Never());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
|
||||
Subject.Handle(new SeriesUpdatedEvent(_series));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.UseSceneNumbering == true)), Times.Once());
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.UseSceneNumbering == true), It.IsAny<bool>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
|
||||
Subject.Handle(new SeriesUpdatedEvent(_series));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Once());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
|
||||
Subject.Handle(new SeriesUpdatedEvent(_series));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Never());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Never());
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
|
||||
Subject.Handle(new SeriesUpdatedEvent(_series));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Never());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Never());
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
@@ -49,27 +49,27 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
_remoteEpisode.ParsedEpisodeInfo.FullSeason = false;
|
||||
_remoteEpisode.Episodes.Last().AirDateUtc = DateTime.UtcNow.AddDays(+2);
|
||||
Mocker.Resolve<FullSeasonSpecification>().IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_all_episodes_have_aired()
|
||||
{
|
||||
Mocker.Resolve<FullSeasonSpecification>().IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_one_episode_has_not_aired()
|
||||
{
|
||||
_remoteEpisode.Episodes.Last().AirDateUtc = DateTime.UtcNow.AddDays(+2);
|
||||
Mocker.Resolve<FullSeasonSpecification>().IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_an_episode_does_not_have_an_air_date()
|
||||
{
|
||||
_remoteEpisode.Episodes.Last().AirDateUtc = null;
|
||||
Mocker.Resolve<FullSeasonSpecification>().IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
|
||||
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,5 +130,26 @@ namespace NzbDrone.Core.Test.DiskSpace
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.GetAvailableSpace(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[TestCase("/boot")]
|
||||
[TestCase("/var/lib/rancher")]
|
||||
[TestCase("/var/lib/rancher/volumes")]
|
||||
[TestCase("/var/lib/kubelet")]
|
||||
[TestCase("/var/lib/docker")]
|
||||
[TestCase("/some/place/docker/aufs")]
|
||||
public void should_not_check_diskspace_for_irrelevant_mounts(string path)
|
||||
{
|
||||
var mount = new Mock<IMount>();
|
||||
mount.SetupGet(v => v.RootDirectory).Returns(path);
|
||||
mount.SetupGet(v => v.DriveType).Returns(System.IO.DriveType.Fixed);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(v => v.GetMounts())
|
||||
.Returns(new List<IMount> { mount.Object });
|
||||
|
||||
var freeSpace = Subject.GetFreeSpace();
|
||||
|
||||
freeSpace.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,12 @@ using NzbDrone.Core.Download.Clients.DownloadStation;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Responses;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SerialNumberProviderFixture : CoreTest<SerialNumberProvider>
|
||||
public class DSMInfoProviderFixture : CoreTest<DSMInfoProvider>
|
||||
{
|
||||
protected DownloadStationSettings _settings;
|
||||
|
||||
@@ -24,17 +25,27 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
private void GivenValidResponse()
|
||||
{
|
||||
Mocker.GetMock<IDSMInfoProxy>()
|
||||
.Setup(d => d.GetSerialNumber(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns("serial");
|
||||
.Setup(d => d.GetInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DSMInfoResponse() { SerialNumber = "serial", Version = "DSM 6.0.1" });
|
||||
}
|
||||
|
||||
private void GivenInvalidResponse()
|
||||
{
|
||||
Mocker.GetMock<IDSMInfoProxy>()
|
||||
.Setup(d => d.GetSerialNumber(It.IsAny<DownloadStationSettings>()))
|
||||
.Setup(d => d.GetInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Throws(new DownloadClientException("Serial response invalid"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_version()
|
||||
{
|
||||
GivenValidResponse();
|
||||
|
||||
var version = Subject.GetDSMVersion(_settings);
|
||||
|
||||
version.Should().Be(new Version("6.0.1"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_hashedserialnumber()
|
||||
{
|
||||
@@ -46,7 +57,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
serial.Should().Be("50DE66B735D30738618568294742FCF1DFA52A47");
|
||||
|
||||
Mocker.GetMock<IDSMInfoProxy>()
|
||||
.Verify(d => d.GetSerialNumber(It.IsAny<DownloadStationSettings>()), Times.Once());
|
||||
.Verify(d => d.GetInfo(It.IsAny<DownloadStationSettings>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -60,7 +71,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
serial2.Should().Be(serial1);
|
||||
|
||||
Mocker.GetMock<IDSMInfoProxy>()
|
||||
.Verify(d => d.GetSerialNumber(It.IsAny<DownloadStationSettings>()), Times.Once());
|
||||
.Verify(d => d.GetInfo(It.IsAny<DownloadStationSettings>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -12,6 +12,7 @@ using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Responses;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
@@ -280,6 +281,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Returns(_downloadStationConfigItems);
|
||||
}
|
||||
|
||||
protected void GivenApiVersions()
|
||||
{
|
||||
Mocker.GetMock<IDownloadStationTaskProxy>()
|
||||
.Setup(s => s.GetApiInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DiskStationApiInfo() { Name = "Task", MinVersion = 1, MaxVersion = 2 });
|
||||
|
||||
Mocker.GetMock<IDownloadStationInfoProxy>()
|
||||
.Setup(s => s.GetApiInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DiskStationApiInfo() { Name = "Info", MinVersion = 1, MaxVersion = 3 });
|
||||
|
||||
Mocker.GetMock<IFileStationProxy>()
|
||||
.Setup(s => s.GetApiInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DiskStationApiInfo() { Name = "File", MinVersion = 1, MaxVersion = 2 });
|
||||
}
|
||||
|
||||
protected void GivenSharedFolder()
|
||||
{
|
||||
Mocker.GetMock<ISharedFolderResolver>()
|
||||
@@ -289,7 +305,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
|
||||
protected void GivenSerialNumber()
|
||||
{
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(s => s.GetSerialNumber(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(_serialNumber);
|
||||
}
|
||||
@@ -359,6 +375,26 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
return tasks.Count;
|
||||
}
|
||||
|
||||
|
||||
protected void GivenDSMVersion(string version)
|
||||
{
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(d => d.GetDSMVersion(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new Version(version));
|
||||
}
|
||||
|
||||
[TestCase("6.0.0", 0)]
|
||||
[TestCase("5.0.0", 1)]
|
||||
public void TestConnection_should_return_validation_failure_as_expected(string version, int count)
|
||||
{
|
||||
GivenApiVersions();
|
||||
GivenDSMVersion(version);
|
||||
|
||||
var result = Subject.Test();
|
||||
|
||||
result.Errors.Should().HaveCount(count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_with_TvDirectory_should_force_directory()
|
||||
{
|
||||
@@ -460,7 +496,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
[Test]
|
||||
public void GetItems_should_throw_if_serial_number_unavailable()
|
||||
{
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(s => s.GetSerialNumber(_settings))
|
||||
.Throws(new ApplicationException("Some unknown exception, HttpException or DownloadClientException"));
|
||||
|
||||
@@ -476,7 +512,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
var remoteEpisode = CreateRemoteEpisode();
|
||||
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(s => s.GetSerialNumber(_settings))
|
||||
.Throws(new ApplicationException("Some unknown exception, HttpException or DownloadClientException"));
|
||||
|
||||
|
||||
@@ -182,6 +182,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Returns(_downloadStationConfigItems);
|
||||
}
|
||||
|
||||
protected void GivenApiVersions()
|
||||
{
|
||||
Mocker.GetMock<IDownloadStationTaskProxy>()
|
||||
.Setup(s => s.GetApiInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DiskStationApiInfo() { Name = "Task", MinVersion = 1, MaxVersion = 2 });
|
||||
|
||||
Mocker.GetMock<IDownloadStationInfoProxy>()
|
||||
.Setup(s => s.GetApiInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DiskStationApiInfo() { Name = "Info", MinVersion = 1, MaxVersion = 3 });
|
||||
|
||||
Mocker.GetMock<IFileStationProxy>()
|
||||
.Setup(s => s.GetApiInfo(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new DiskStationApiInfo() { Name = "File", MinVersion = 1, MaxVersion = 2 });
|
||||
}
|
||||
|
||||
protected void GivenSharedFolder()
|
||||
{
|
||||
Mocker.GetMock<ISharedFolderResolver>()
|
||||
@@ -191,7 +206,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
|
||||
protected void GivenSerialNumber()
|
||||
{
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(s => s.GetSerialNumber(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(_serialNumber);
|
||||
}
|
||||
@@ -245,6 +260,25 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
Mocker.GetMock<IDownloadStationTaskProxy>()
|
||||
.Setup(d => d.GetTasks(_settings))
|
||||
.Returns(tasks);
|
||||
}
|
||||
|
||||
protected void GivenDSMVersion(string version)
|
||||
{
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(d => d.GetDSMVersion(It.IsAny<DownloadStationSettings>()))
|
||||
.Returns(new Version(version));
|
||||
}
|
||||
|
||||
[TestCase("6.0.0", 0)]
|
||||
[TestCase("5.0.0", 1)]
|
||||
public void TestConnection_should_return_validation_failure_as_expected(string version, int count)
|
||||
{
|
||||
GivenApiVersions();
|
||||
GivenDSMVersion(version);
|
||||
|
||||
var result = Subject.Test();
|
||||
|
||||
result.Errors.Should().HaveCount(count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -348,7 +382,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
[Test]
|
||||
public void GetItems_should_throw_if_serial_number_unavailable()
|
||||
{
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(s => s.GetSerialNumber(_settings))
|
||||
.Throws(new ApplicationException("Some unknown exception, HttpException or DownloadClientException"));
|
||||
|
||||
@@ -364,7 +398,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
var remoteEpisode = CreateRemoteEpisode();
|
||||
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
Mocker.GetMock<IDSMInfoProvider>()
|
||||
.Setup(s => s.GetSerialNumber(_settings))
|
||||
.Throws(new ApplicationException("Some unknown exception, HttpException or DownloadClientException"));
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
private RemoteEpisode _parseResult;
|
||||
private List<IDownloadClient> _downloadClients;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -82,7 +83,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteEpisode>()));
|
||||
|
||||
|
||||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
VerifyEventPublished<EpisodeGrabbedEvent>();
|
||||
@@ -93,7 +94,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteEpisode>()));
|
||||
|
||||
|
||||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
mock.Verify(s => s.Download(It.IsAny<RemoteEpisode>()), Times.Once());
|
||||
@@ -117,7 +118,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteEpisode>()))
|
||||
.Callback<RemoteEpisode>(v => {
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new WebException());
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new WebException());
|
||||
});
|
||||
|
||||
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
|
||||
@@ -136,7 +137,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteEpisode>()))
|
||||
.Callback<RemoteEpisode>(v => {
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
|
||||
});
|
||||
|
||||
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
|
||||
@@ -180,14 +181,27 @@ namespace NzbDrone.Core.Test.Download
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_attempt_download_if_client_isnt_configure()
|
||||
public void should_not_attempt_download_if_client_isnt_configured()
|
||||
{
|
||||
Subject.DownloadReport(_parseResult);
|
||||
Assert.Throws<DownloadClientUnavailableException>(() => Subject.DownloadReport(_parseResult));
|
||||
|
||||
Mocker.GetMock<IDownloadClient>().Verify(c => c.Download(It.IsAny<RemoteEpisode>()), Times.Never());
|
||||
VerifyEventNotPublished<EpisodeGrabbedEvent>();
|
||||
}
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
[Test]
|
||||
public void should_not_attempt_download_if_client_is_disabled()
|
||||
{
|
||||
WithUsenetClient();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusService>()
|
||||
.Setup(v => v.IsDisabled(It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
Assert.Throws<DownloadClientUnavailableException>(() => Subject.DownloadReport(_parseResult));
|
||||
|
||||
Mocker.GetMock<IDownloadClient>().Verify(c => c.Download(It.IsAny<RemoteEpisode>()), Times.Never());
|
||||
VerifyEventNotPublished<EpisodeGrabbedEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Evolution World</title>
|
||||
<description>Advanced RSS Feed for xbtitFM by Petr1fied</description>
|
||||
<link>http://ew.pw</link>
|
||||
<lastBuildDate>Tue, 15 Aug 2017 00:00:00 +0000</lastBuildDate>
|
||||
<copyright>(c) 2017 Evolution World</copyright>
|
||||
<atom:link href="http://ew.pw/advanced_rss.php?cats=34%3B35%3B36%3B37%3B38%3B39%3B41%3B48%3B49%3B50%3B51%3B79%3B80%3B81&tpc=100&auth=secret" rel="self" type="application/rss+xml" />
|
||||
|
||||
<item>
|
||||
<title><![CDATA[[TVShow --> TVShow Bluray 720p] Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER [SEEDERS (3)/LEECHERS (0)]]]></title>
|
||||
<description><![CDATA[<br />Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER<br /><br /><br /><br />Plot:<br /><br />Various chronicles of deception, intrigue and murder in and around frozen Minnesota.<br /><br />Note::-<br />Encode is tested and its perfect, no sync issue there in any episode.<br />All episodes comes with AC3 Audio for better audio and video plaback and English Subs are muxed in video .<br /><br />TECHNiCAL Information:<br /><br /><br />RUNTIME..................: 1 hr x 10<br />Total SIZE...............: 9.75 GiB<br />Total Episodes...........: 10<br />VIDEO CODEC..............: x264 2nd Pass (High,L4.1)<br />RESOLUTION...............: 1280x720<br />BITRATE (Video)..........: 2100 Kbps - 2400 kbps<br />Aspect Ratio.............: 16:9<br />Video Container..........: MKV<br />FRAMERATE................: 23.967 fps<br />AUDIO....................: English AC3 6 Channel 384 kbps<br />SUBTITLES................: English, English (SDH)<br />CHAPTERS.................: Yes<br />SOURCE...................: DON (Thanks !)<br /><br /><br />GENRE...................: Crime | Drama | Thriller<br />RATING..................: 9.1/10 from 140,765 users<br />IMDB link...............: <a href="http://www.imdb.com/title/tt2802850/" target="_blank">http://www.imdb.com/title/tt2802850/</a>]]></description>
|
||||
<link>http://ew.pw/index.php?page=torrent-details&id=dea071a7a62a0d662538d46402fb112f30b8c9fa</link>
|
||||
<guid>http://ew.pw/index.php?page=torrent-details&id=dea071a7a62a0d662538d46402fb112f30b8c9fa</guid>
|
||||
<enclosure url="http://ew.pw/download.php?id=dea071a7a62a0d662538d46402fb112f30b8c9fa&f=Fargo%20S01%20Complete%20Season%201%20720p%20BRRip%20DD5.1%20x264-PSYPHER.torrent&auth=secret" length="13625" type="application/x-bittorrent" />
|
||||
<pubDate>Sun, 13 Aug 2017 22:21:43 +0000</pubDate>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title><![CDATA[[TVShow --> TVShow Bluray 720p] American Horror Story S04 Complete Season 4 720p BRRip DD5.1 x264 - PSYPHER [SEEDERS (2)/LEECHERS (0)]]]></title>
|
||||
<description><![CDATA[]]></description>
|
||||
<link>http://ew.pw/index.php?page=torrent-details&id=2725fe19ea2addf5aafbd523d134191b8abbb2ee</link>
|
||||
<guid>http://ew.pw/index.php?page=torrent-details&id=2725fe19ea2addf5aafbd523d134191b8abbb2ee</guid>
|
||||
<enclosure url="http://ew.pw/download.php?id=2725fe19ea2addf5aafbd523d134191b8abbb2ee&f=American%20Horror%20Story%20S04%20Complete%20Season%204%20720p%20BRRip%20DD5.1%20x264%20-%20PSYPHER.torrent&auth=secret" length="16583" type="application/x-bittorrent" />
|
||||
<pubDate>Fri, 28 Jul 2017 16:29:51 +0000</pubDate>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.ThingiProvider.Status;
|
||||
|
||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||
{
|
||||
[TestFixture]
|
||||
public class FixFutureDownloadClientStatusTimesFixture : CoreTest<FixFutureDownloadClientStatusTimes>
|
||||
{
|
||||
[Test]
|
||||
public void should_set_disabled_till_when_its_too_far_in_the_future()
|
||||
{
|
||||
var disabledTillTime = EscalationBackOff.Periods[1];
|
||||
var downloadClientStatuses = Builder<DownloadClientStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.EscalationLevel = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(downloadClientStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<DownloadClientStatus>>(i => i.All(
|
||||
s => s.DisabledTill.Value < DateTime.UtcNow.AddMinutes(disabledTillTime)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_set_initial_failure_when_its_in_the_future()
|
||||
{
|
||||
var downloadClientStatuses = Builder<DownloadClientStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.EscalationLevel = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(downloadClientStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<DownloadClientStatus>>(i => i.All(
|
||||
s => s.InitialFailure.Value <= DateTime.UtcNow))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_set_most_recent_failure_when_its_in_the_future()
|
||||
{
|
||||
var downloadClientStatuses = Builder<DownloadClientStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(5))
|
||||
.With(t => t.EscalationLevel = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(downloadClientStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<DownloadClientStatus>>(i => i.All(
|
||||
s => s.MostRecentFailure.Value <= DateTime.UtcNow))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_change_statuses_when_times_are_in_the_past()
|
||||
{
|
||||
var downloadClientStatuses = Builder<DownloadClientStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.EscalationLevel = 0)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(downloadClientStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<DownloadClientStatus>>(i => i.Count == 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.ThingiProvider.Status;
|
||||
|
||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||
{
|
||||
[TestFixture]
|
||||
public class FixFutureIndexerStatusTimesFixture : CoreTest<FixFutureIndexerStatusTimes>
|
||||
{
|
||||
[Test]
|
||||
public void should_set_disabled_till_when_its_too_far_in_the_future()
|
||||
{
|
||||
var disabledTillTime = EscalationBackOff.Periods[1];
|
||||
var indexerStatuses = Builder<IndexerStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.EscalationLevel = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(indexerStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<IndexerStatus>>(i => i.All(
|
||||
s => s.DisabledTill.Value < DateTime.UtcNow.AddMinutes(disabledTillTime)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_set_initial_failure_when_its_in_the_future()
|
||||
{
|
||||
var indexerStatuses = Builder<IndexerStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.EscalationLevel = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(indexerStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<IndexerStatus>>(i => i.All(
|
||||
s => s.InitialFailure.Value < DateTime.UtcNow))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_set_most_recent_failure_when_its_in_the_future()
|
||||
{
|
||||
var indexerStatuses = Builder<IndexerStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(5))
|
||||
.With(t => t.EscalationLevel = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(indexerStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<IndexerStatus>>(i => i.All(
|
||||
s => s.MostRecentFailure.Value < DateTime.UtcNow))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_change_statuses_when_times_are_in_the_past()
|
||||
{
|
||||
var indexerStatuses = Builder<IndexerStatus>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.DisabledTill = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.InitialFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.MostRecentFailure = DateTime.UtcNow.AddDays(-5))
|
||||
.With(t => t.EscalationLevel = 0)
|
||||
.BuildListOfNew();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(indexerStatuses);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IIndexerStatusRepository>()
|
||||
.Verify(v => v.UpdateMany(
|
||||
It.Is<List<IndexerStatus>>(i => i.Count == 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Practices.ObjectBuilder2;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||
{
|
||||
[TestFixture]
|
||||
public class FixFutureRunScheduledTasksFixture : DbTest<FixFutureRunScheduledTasks, ScheduledTask>
|
||||
{
|
||||
[Test]
|
||||
public void should_set_last_execution_time_to_now_when_its_in_the_future()
|
||||
{
|
||||
var tasks = Builder<ScheduledTask>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.LastExecution = DateTime.UtcNow.AddDays(5))
|
||||
.BuildListOfNew();
|
||||
|
||||
Db.InsertMany(tasks);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
AllStoredModels.ForEach(t => t.LastExecution.Should().BeBefore(DateTime.UtcNow));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_change_last_execution_time_when_its_in_the_past()
|
||||
{
|
||||
var expectedTime = DateTime.UtcNow.AddHours(-1);
|
||||
|
||||
var tasks = Builder<ScheduledTask>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(t => t.LastExecution = expectedTime)
|
||||
.BuildListOfNew();
|
||||
|
||||
Db.InsertMany(tasks);
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
AllStoredModels.ForEach(t => t.LastExecution.Should().Be(expectedTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
||||
[TestCase("100 Kb/s")]
|
||||
[TestCase(" 12341234")]
|
||||
[TestCase("12341234 other")]
|
||||
[TestCase("")]
|
||||
public void should_not_parse_size(string sizeString)
|
||||
{
|
||||
var result = RssParser.ParseSize(sizeString, true);
|
||||
|
||||
@@ -261,6 +261,33 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
|
||||
torrentInfo.DownloadUrl.Should().Be("https://alpharatio.cc/torrents.php?action=download&authkey=private_auth_key&torrent_pass=private_torrent_pass&id=465831");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_parse_recent_feed_from_EveolutionWorld_without_size()
|
||||
{
|
||||
Subject.Definition.Settings.As<TorrentRssIndexerSettings>().AllowZeroSize = true;
|
||||
GivenRecentFeedResponse("TorrentRss/EvolutionWorld.xml");
|
||||
|
||||
var releases = Subject.FetchRecent();
|
||||
|
||||
releases.Should().HaveCount(2);
|
||||
releases.First().Should().BeOfType<TorrentInfo>();
|
||||
|
||||
var torrentInfo = releases.First() as TorrentInfo;
|
||||
|
||||
torrentInfo.Title.Should().Be("[TVShow --> TVShow Bluray 720p] Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER [SEEDERS (3)/LEECHERS (0)]");
|
||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
torrentInfo.DownloadUrl.Should().Be("http://ew.pw/download.php?id=dea071a7a62a0d662538d46402fb112f30b8c9fa&f=Fargo%20S01%20Complete%20Season%201%20720p%20BRRip%20DD5.1%20x264-PSYPHER.torrent&auth=secret");
|
||||
torrentInfo.InfoUrl.Should().BeNullOrEmpty();
|
||||
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2017-08-13T22:21:43Z").ToUniversalTime());
|
||||
torrentInfo.Size.Should().Be(0);
|
||||
torrentInfo.InfoHash.Should().BeNull();
|
||||
torrentInfo.MagnetUrl.Should().BeNull();
|
||||
torrentInfo.Peers.Should().NotHaveValue();
|
||||
torrentInfo.Seeders.Should().NotHaveValue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_record_indexer_failure_if_unsupported_feed()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
@@ -269,6 +269,22 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
.Verify(v => v.GetImportDecisions(It.Is<List<string>>(l => l.Count == 1), _series), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_scan_files_that_start_with_period()
|
||||
{
|
||||
GivenSeriesFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
Path.Combine(_series.Path, "Season 1", ".s01e01.mkv").AsOsAgnostic()
|
||||
});
|
||||
|
||||
Subject.Scan(_series);
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Verify(v => v.GetImportDecisions(It.Is<List<string>>(l => l.Count == 1), _series), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_scan_subfolder_of_season_folder_that_starts_with_a_period()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using FluentAssertions;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
||||
using NzbDrone.Test.Common;
|
||||
@@ -104,6 +104,20 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
|
||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_empty_groups_in_AudioChannelPositions()
|
||||
{
|
||||
var mediaInfoModel = new MediaInfoModel
|
||||
{
|
||||
AudioChannels = 2,
|
||||
AudioChannelPositions = " / 2/0/0.0",
|
||||
AudioChannelPositionsText = null,
|
||||
SchemaRevision = 3
|
||||
};
|
||||
|
||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_sum_first_series_of_numbers_from_AudioChannelPositions()
|
||||
{
|
||||
@@ -117,5 +131,19 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
|
||||
|
||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_sum_dual_mono_representation_AudioChannelPositions()
|
||||
{
|
||||
var mediaInfoModel = new MediaInfoModel
|
||||
{
|
||||
AudioChannels = 2,
|
||||
AudioChannelPositions = "1+1",
|
||||
AudioChannelPositionsText = null,
|
||||
SchemaRevision = 3
|
||||
};
|
||||
|
||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(2.0m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
|
||||
[TestCase("TrueHD, A_TRUEHD, , ", "", "TrueHD")]
|
||||
[TestCase("WMA, 161, , ", "Droned.wmv", "WMA")]
|
||||
[TestCase("WMA, 162, Pro, ", "B.N.S04E18.720p.WEB-DL", "WMA")]
|
||||
[TestCase("Opus, A_OPUS, , ", "Roadkill Ep3x11 - YouTube.webm", "Opus")]
|
||||
[TestCase("mp3 , 0, , ", "climbing.mp4", "MP3")]
|
||||
public void should_format_audio_format(string audioFormatPack, string sceneName, string expectedFormat)
|
||||
{
|
||||
var split = audioFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None);
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
|
||||
[TestCase("V.MPEG4/ISO/AVC, V.MPEG4/ISO/AVC, , ", "pd.2015.S03E08.720p.iP.WEBRip.AAC2.0.H264-BTW", "h264")]
|
||||
[TestCase("WMV2, WMV2, , ", "Droned.wmv", "WMV")]
|
||||
[TestCase("xvid, xvid, , ", "", "XviD")]
|
||||
[TestCase("div3, div3, , ", "spsm.dvdrip.divx.avi'.", "DivX")]
|
||||
[TestCase("VP6, 4, , ", "Top Gear - S12E01 - Lorries - SD TV.flv", "VP6")]
|
||||
[TestCase("VP7, VP70, General, ", "Sweet Seymour.avi", "VP7")]
|
||||
[TestCase("VP8, V_VP8, , ", "Dick.mkv", "VP8")]
|
||||
[TestCase("VP9, V_VP9, , ", "Roadkill Ep3x11 - YouTube.webm", "VP9")]
|
||||
public void should_format_video_format(string videoFormatPack, string sceneName, string expectedFormat)
|
||||
{
|
||||
var split = videoFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None);
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
<Compile Include="Download\DownloadClientTests\DelugeTests\DelugeFixture.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\DownloadClientFixtureBase.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\DownloadStationTests\TorrentDownloadStationFixture.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\DownloadStationTests\SerialNumberProviderFixture.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\DownloadStationTests\DSMInfoProviderFixture.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\DownloadStationTests\SharedFolderResolverFixture.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\DownloadStationTests\UsenetDownloadStationFixture.cs" />
|
||||
<Compile Include="Download\DownloadClientTests\HadoukenTests\HadoukenFixture.cs" />
|
||||
@@ -241,7 +241,8 @@
|
||||
<Compile Include="Housekeeping\Housekeepers\CleanupDownloadClientUnavailablePendingReleasesFixture.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\CleanupUnusedTagsFixture.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\CleanupOrphanedPendingReleasesFixture.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureRunScheduledTasksFixture.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureDownloadClientStatusTimesFixture.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureIndexerStatusTimesFixture.cs" />
|
||||
<Compile Include="Http\HttpProxySettingsProviderFixture.cs" />
|
||||
<Compile Include="Http\TorCacheHttpRequestInterceptorFixture.cs" />
|
||||
<Compile Include="IndexerSearchTests\SeriesSearchServiceFixture.cs" />
|
||||
@@ -432,6 +433,10 @@
|
||||
<Link>sqlite3.dll</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Files\Indexers\TorrentRss\EvolutionWorld.xml">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Files\Indexers\TorrentRss\AlphaRatio.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using FluentAssertions;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@@ -46,6 +46,9 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD.HUNDUB-LOL", Language.Hungarian)]
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD.ENG.HUN-LOL", Language.Hungarian)]
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD.HUN-LOL", Language.Hungarian)]
|
||||
[TestCase("Avatar.The.Last.Airbender.S01-03.DVDRip.HebDub",Language.Hebrew)]
|
||||
[TestCase("Prison.Break.S05E01.WEBRip.x264.AC3.LT.EN-CNN", Language.Lithuanian)]
|
||||
[TestCase("The.Walking.Dead.S07E11.WEB Rip.XviD.Louige-CZ.EN.5.1", Language.Czech)]
|
||||
public void should_parse_language(string postTitle, Language language)
|
||||
{
|
||||
var result = LanguageParser.ParseLanguage(postTitle);
|
||||
|
||||
@@ -72,5 +72,13 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
Parser.Parser.ParseTitle(title).Quality.Quality.Should().NotBe(Quality.Unknown);
|
||||
Parser.Parser.ParseTitle(title).Quality.QualitySource.Should().Be(QualitySource.Extension);
|
||||
}
|
||||
|
||||
|
||||
[TestCase("Revolution.S01E02.Chained.Heat.mkv", "Revolution.S01E02.Chained.Heat")]
|
||||
public void should_parse_releasetitle(string path, string releaseTitle)
|
||||
{
|
||||
var result = Parser.Parser.ParseTitle(path);
|
||||
result.ReleaseTitle.Should().Be(releaseTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,8 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
[TestCase("Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", false)]
|
||||
[TestCase("The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", false)]
|
||||
[TestCase("Da.Vincis.Demons.S02E04.480p.WEB.DL.nSD.x264-NhaNc3", false)]
|
||||
[TestCase("Incorporated.S01E08.Das.geloeschte.Ich.German.Dubbed.DL.AmazonHD.x264-TVS", false)]
|
||||
[TestCase("Haters.Back.Off.S01E04.Rod.Trip.mit.meinem.Onkel.German.DL.NetflixUHD.x264", false)]
|
||||
public void should_parse_webdl480p_quality(string title, bool proper)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Quality.WEBDL480p, proper);
|
||||
@@ -145,6 +147,9 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
[TestCase("Castle.S06E23.720p.WebHD.h264-euHD", false)]
|
||||
[TestCase("The.Nightly.Show.2016.03.14.720p.WEB.x264-spamTV", false)]
|
||||
[TestCase("The.Nightly.Show.2016.03.14.720p.WEB.h264-spamTV", false)]
|
||||
[TestCase("Incorporated.S01E08.Das.geloeschte.Ich.German.DD51.Dubbed.DL.720p.AmazonHD.x264-TVS", false)]
|
||||
[TestCase("Marco.Polo.S01E11.One.Hundred.Eyes.2015.German.DD51.DL.720p.NetflixUHD.x264.NewUp.by.Wunschtante", false)]
|
||||
[TestCase("Hush 2016 German DD51 DL 720p NetflixHD x264-TVS", false)]
|
||||
public void should_parse_webdl720p_quality(string title, bool proper)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Quality.WEBDL720p, proper);
|
||||
@@ -166,6 +171,8 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
[TestCase("Series Title S06E08 No One PROPER 1080p WEB DD5 1 H 264-EXCLUSIVE", true)]
|
||||
[TestCase("Series Title S06E08 No One PROPER 1080p WEB H 264-EXCLUSIVE", true)]
|
||||
[TestCase("The.Simpsons.S25E21.Pay.Pal.1080p.WEB-DL.DD5.1.H.264-NTb", false)]
|
||||
[TestCase("Incorporated.S01E08.Das.geloeschte.Ich.German.DD51.Dubbed.DL.1080p.AmazonHD.x264-TVS", false)]
|
||||
[TestCase("Death.Note.2017.German.DD51.DL.1080p.NetflixHD.x264-TVS", false)]
|
||||
public void should_parse_webdl1080p_quality(string title, bool proper)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Quality.WEBDL1080p, proper);
|
||||
@@ -178,6 +185,8 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
[TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.x264-spamTV", false)]
|
||||
[TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.h264-spamTV", false)]
|
||||
[TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.PROPER.h264-spamTV", true)]
|
||||
[TestCase("House.of.Cards.US.s05e13.4K.UHD.WEB.DL", false)]
|
||||
[TestCase("House.of.Cards.US.s05e13.UHD.4K.WEB.DL", false)]
|
||||
public void should_parse_webdl2160p_quality(string title, bool proper)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Quality.WEBDL2160p, proper);
|
||||
@@ -215,6 +224,13 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
ParseAndVerifyQuality(title, Quality.Bluray1080p, proper);
|
||||
}
|
||||
|
||||
[TestCase("House.of.Cards.US.s05e13.4K.UHD.Bluray", false)]
|
||||
[TestCase("House.of.Cards.US.s05e13.UHD.4K.Bluray", false)]
|
||||
public void should_parse_bluray2160p_quality(string title, bool proper)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Quality.Bluray2160p, proper);
|
||||
}
|
||||
|
||||
[TestCase("POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", false)]
|
||||
[TestCase("How I Met Your Mother S01E18 Nothing Good Happens After 2 A.M. 720p HDTV DD5.1 MPEG2-TrollHD", false)]
|
||||
[TestCase("The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", false)]
|
||||
|
||||
@@ -34,24 +34,47 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
result.FullSeason.Should().BeTrue();
|
||||
}
|
||||
|
||||
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER")]
|
||||
[TestCase("Punky Brewster S01 EXTRAS DVDRip XviD RUNNER")]
|
||||
[TestCase("Instant Star S03 EXTRAS DVDRip XviD OSiTV")]
|
||||
public void should_parse_season_extras(string postTitle)
|
||||
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", "Acropolis Now", 5)]
|
||||
[TestCase("Punky Brewster S01 EXTRAS DVDRip XviD RUNNER", "Punky Brewster", 1)]
|
||||
[TestCase("Instant Star S03 EXTRAS DVDRip XviD OSiTV", "Instant Star", 3)]
|
||||
[TestCase("The.Flash.S03.Extras.01.Deleted.Scenes.720p", "The Flash", 3)]
|
||||
[TestCase("The.Flash.S03.Extras.02.720p", "The Flash", 3)]
|
||||
public void should_parse_season_extras(string postTitle, string title, int season)
|
||||
{
|
||||
var result = Parser.Parser.ParseTitle(postTitle);
|
||||
|
||||
result.Should().BeNull();
|
||||
result.SeasonNumber.Should().Be(season);
|
||||
result.SeriesTitle.Should().Be(title);
|
||||
result.EpisodeNumbers.Should().BeEmpty();
|
||||
result.AbsoluteEpisodeNumbers.Should().BeEmpty();
|
||||
result.FullSeason.Should().BeTrue();
|
||||
result.IsSeasonExtra.Should().BeTrue();
|
||||
}
|
||||
|
||||
[TestCase("Lie.to.Me.S03.SUBPACK.DVDRip.XviD-REWARD")]
|
||||
[TestCase("The.Middle.S02.SUBPACK.DVDRip.XviD-REWARD")]
|
||||
[TestCase("CSI.S11.SUBPACK.DVDRip.XviD-REWARD")]
|
||||
public void should_parse_season_subpack(string postTitle)
|
||||
[TestCase("Lie.to.Me.S03.SUBPACK.DVDRip.XviD-REWARD", "Lie to Me", 3)]
|
||||
[TestCase("The.Middle.S02.SUBPACK.DVDRip.XviD-REWARD", "The Middle", 2)]
|
||||
[TestCase("CSI.S11.SUBPACK.DVDRip.XviD-REWARD", "CSI", 11)]
|
||||
public void should_parse_season_subpack(string postTitle, string title, int season)
|
||||
{
|
||||
var result = Parser.Parser.ParseTitle(postTitle);
|
||||
result.SeasonNumber.Should().Be(season);
|
||||
result.SeriesTitle.Should().Be(title);
|
||||
result.EpisodeNumbers.Should().BeEmpty();
|
||||
result.AbsoluteEpisodeNumbers.Should().BeEmpty();
|
||||
result.FullSeason.Should().BeTrue();
|
||||
result.IsSeasonExtra.Should().BeTrue();
|
||||
}
|
||||
|
||||
result.Should().BeNull();
|
||||
[TestCase("The.Ranch.2016.S02.Part.1.1080p.NF.WEBRip.DD5.1.x264-NTb", "The Ranch 2016", 2, 1)]
|
||||
public void should_parse_partial_season_release(string postTitle, string title, int season, int seasonPart)
|
||||
{
|
||||
var result = Parser.Parser.ParseTitle(postTitle);
|
||||
result.SeasonNumber.Should().Be(season);
|
||||
result.SeriesTitle.Should().Be(title);
|
||||
result.EpisodeNumbers.Should().BeEmpty();
|
||||
result.AbsoluteEpisodeNumbers.Should().BeEmpty();
|
||||
result.FullSeason.Should().BeFalse();
|
||||
result.IsPartialSeason.Should().BeTrue();
|
||||
result.SeasonPart.Should().Be(seasonPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeMonitoredServiceTests
|
||||
Subject.SetEpisodeMonitoredStatus(_series, null);
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Once());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Once());
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.UpdateEpisodes(It.IsAny<List<Episode>>()), Times.Never());
|
||||
@@ -249,13 +249,13 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeMonitoredServiceTests
|
||||
private void VerifySeasonMonitored(Func<Season, bool> predicate)
|
||||
{
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Where(predicate).All(n => n.Monitored))));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Where(predicate).All(n => n.Monitored)), It.IsAny<bool>()));
|
||||
}
|
||||
|
||||
private void VerifySeasonNotMonitored(Func<Season, bool> predicate)
|
||||
{
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Where(predicate).All(n => !n.Monitored))));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Where(predicate).All(n => !n.Monitored)), It.IsAny<bool>()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Never());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -81,7 +81,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(_command);
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Path == expectedPath)), Times.Once());
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Path == expectedPath), It.IsAny<bool>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(_command);
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Path == _command.DestinationPath)), Times.Once());
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Path == _command.DestinationPath), It.IsAny<bool>()), Times.Once());
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Verify(v => v.GetSeriesFolder(It.IsAny<Series>(), null), Times.Never());
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny<bool>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 0).Monitored == false)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 0).Monitored == false), It.IsAny<bool>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -92,7 +92,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.TvRageId == newSeriesInfo.TvRageId)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.TvRageId == newSeriesInfo.TvRageId), It.IsAny<bool>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -106,7 +106,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.TvMazeId == newSeriesInfo.TvMazeId)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.TvMazeId == newSeriesInfo.TvMazeId), It.IsAny<bool>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -115,7 +115,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>()), Times.Never());
|
||||
.Verify(v => v.UpdateSeries(It.IsAny<Series>(), It.IsAny<bool>()), Times.Never());
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.TvdbId == newSeriesInfo.TvdbId)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.TvdbId == newSeriesInfo.TvdbId), It.IsAny<bool>()));
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2), It.IsAny<bool>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -177,7 +177,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
Subject.Execute(new RefreshSeriesCommand(_series.Id));
|
||||
|
||||
Mocker.GetMock<ISeriesService>()
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2)));
|
||||
.Verify(v => v.UpdateSeries(It.Is<Series>(s => s.Seasons.Count == 2), It.IsAny<bool>()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace NzbDrone.Core.Backup
|
||||
{
|
||||
public class Backup
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public string Name { get; set; }
|
||||
public BackupType Type { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
}
|
||||
|
||||
@@ -4,7 +4,18 @@ namespace NzbDrone.Core.Backup
|
||||
{
|
||||
public class BackupCommand : Command
|
||||
{
|
||||
public BackupType Type { get; set; }
|
||||
public BackupType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Trigger == CommandTrigger.Scheduled)
|
||||
{
|
||||
return BackupType.Scheduled;
|
||||
}
|
||||
|
||||
return BackupType.Manual;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace NzbDrone.Core.Backup
|
||||
{
|
||||
backups.AddRange(GetBackupFiles(folder).Select(b => new Backup
|
||||
{
|
||||
Path = Path.GetFileName(b),
|
||||
Name = Path.GetFileName(b),
|
||||
Type = backupType,
|
||||
Time = _diskProvider.FileGetLastWrite(b)
|
||||
}));
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
@@ -22,6 +23,8 @@ namespace NzbDrone.Core.DiskSpace
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
private static readonly Regex _regexSpecialDrive = new Regex("^/var/lib/(docker|rancher|kubelet)(/|$)|^/boot(/|$)|/docker(/var)?/aufs(/|$)", RegexOptions.Compiled);
|
||||
|
||||
public DiskSpaceService(ISeriesService seriesService, IConfigService configService, IDiskProvider diskProvider, Logger logger)
|
||||
{
|
||||
_seriesService = seriesService;
|
||||
@@ -32,37 +35,37 @@ namespace NzbDrone.Core.DiskSpace
|
||||
|
||||
public List<DiskSpace> GetFreeSpace()
|
||||
{
|
||||
var diskSpace = new List<DiskSpace>();
|
||||
diskSpace.AddRange(GetSeriesFreeSpace());
|
||||
diskSpace.AddRange(GetDroneFactoryFreeSpace());
|
||||
diskSpace.AddRange(GetFixedDisksFreeSpace());
|
||||
var importantRootFolders = GetSeriesRootPaths().Concat(GetDroneFactoryRootPaths()).Distinct().ToList();
|
||||
|
||||
return diskSpace.DistinctBy(d => d.Path).ToList();
|
||||
var optionalRootFolders = GetFixedDisksRootPaths().Except(importantRootFolders).Distinct().ToList();
|
||||
|
||||
var diskSpace = GetDiskSpace(importantRootFolders).Concat(GetDiskSpace(optionalRootFolders, true)).ToList();
|
||||
|
||||
return diskSpace;
|
||||
}
|
||||
|
||||
private IEnumerable<DiskSpace> GetSeriesFreeSpace()
|
||||
private IEnumerable<string> GetSeriesRootPaths()
|
||||
{
|
||||
var seriesRootPaths = _seriesService.GetAllSeries()
|
||||
return _seriesService.GetAllSeries()
|
||||
.Where(s => _diskProvider.FolderExists(s.Path))
|
||||
.Select(s => _diskProvider.GetPathRoot(s.Path))
|
||||
.Distinct();
|
||||
|
||||
return GetDiskSpace(seriesRootPaths);
|
||||
}
|
||||
|
||||
private IEnumerable<DiskSpace> GetDroneFactoryFreeSpace()
|
||||
private IEnumerable<string> GetDroneFactoryRootPaths()
|
||||
{
|
||||
if (_configService.DownloadedEpisodesFolder.IsNotNullOrWhiteSpace() && _diskProvider.FolderExists(_configService.DownloadedEpisodesFolder))
|
||||
{
|
||||
return GetDiskSpace(new[] { _diskProvider.GetPathRoot(_configService.DownloadedEpisodesFolder) });
|
||||
yield return _configService.DownloadedEpisodesFolder;
|
||||
}
|
||||
|
||||
return new List<DiskSpace>();
|
||||
}
|
||||
|
||||
private IEnumerable<DiskSpace> GetFixedDisksFreeSpace()
|
||||
private IEnumerable<string> GetFixedDisksRootPaths()
|
||||
{
|
||||
return GetDiskSpace(_diskProvider.GetMounts().Where(d => d.DriveType == DriveType.Fixed).Select(d => d.RootDirectory), true);
|
||||
return _diskProvider.GetMounts()
|
||||
.Where(d => d.DriveType == DriveType.Fixed)
|
||||
.Where(d => !_regexSpecialDrive.IsMatch(d.RootDirectory))
|
||||
.Select(d => d.RootDirectory);
|
||||
}
|
||||
|
||||
private IEnumerable<DiskSpace> GetDiskSpace(IEnumerable<string> paths, bool suppressWarnings = false)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Disk;
|
||||
@@ -109,7 +109,17 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
||||
var outputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.DownloadPath));
|
||||
item.OutputPath = outputPath + torrent.Name;
|
||||
item.RemainingSize = torrent.Size - torrent.BytesDownloaded;
|
||||
item.RemainingTime = TimeSpan.FromSeconds(torrent.Eta);
|
||||
|
||||
try
|
||||
{
|
||||
item.RemainingTime = TimeSpan.FromSeconds(torrent.Eta);
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
_logger.Debug(ex, "ETA for {0} is too long: {1}", torrent.Name, torrent.Eta);
|
||||
item.RemainingTime = TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
item.TotalSize = torrent.Size;
|
||||
|
||||
if (torrent.State == DelugeTorrentStatus.Error)
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Common.Crypto;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Responses;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
public interface IDSMInfoProvider
|
||||
{
|
||||
string GetSerialNumber(DownloadStationSettings settings);
|
||||
Version GetDSMVersion(DownloadStationSettings settings);
|
||||
}
|
||||
|
||||
public class DSMInfoProvider : IDSMInfoProvider
|
||||
{
|
||||
private readonly IDSMInfoProxy _proxy;
|
||||
private ICached<DSMInfoResponse> _cache;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DSMInfoProvider(ICacheManager cacheManager,
|
||||
IDSMInfoProxy proxy,
|
||||
Logger logger)
|
||||
{
|
||||
_proxy = proxy;
|
||||
_cache = cacheManager.GetCache<DSMInfoResponse>(GetType());
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private DSMInfoResponse GetInfo(DownloadStationSettings settings)
|
||||
{
|
||||
return _cache.Get(settings.Host, () => _proxy.GetInfo(settings), TimeSpan.FromMinutes(5));
|
||||
}
|
||||
|
||||
public string GetSerialNumber(DownloadStationSettings settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
return HashConverter.GetHash(GetInfo(settings).SerialNumber).ToHexString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Could not get the serial number from Download Station {0}:{1}", settings.Host, settings.Port);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Version GetDSMVersion(DownloadStationSettings settings)
|
||||
{
|
||||
var info = GetInfo(settings);
|
||||
|
||||
Regex regex = new Regex(@"DSM (?<version>[\d.]*)");
|
||||
|
||||
var dsmVersion = regex.Match(info.Version).Groups["version"].Value;
|
||||
|
||||
return new Version(dsmVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static NzbDrone.Core.Download.Clients.DownloadStation.DownloadStationTask;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Responses;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
{
|
||||
public interface IDSMInfoProxy
|
||||
public interface IDSMInfoProxy : IDiskStationProxy
|
||||
{
|
||||
string GetSerialNumber(DownloadStationSettings settings);
|
||||
DSMInfoResponse GetInfo(DownloadStationSettings settings);
|
||||
}
|
||||
|
||||
public class DSMInfoProxy : DiskStationProxyBase, IDSMInfoProxy
|
||||
@@ -19,15 +17,15 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
{
|
||||
}
|
||||
|
||||
public string GetSerialNumber(DownloadStationSettings settings)
|
||||
public DSMInfoResponse GetInfo(DownloadStationSettings settings)
|
||||
{
|
||||
var info = GetApiInfo(settings);
|
||||
|
||||
var requestBuilder = BuildRequest(settings, "getinfo", info.MinVersion);
|
||||
|
||||
var response = ProcessRequest<DSMInfoResponse>(requestBuilder, "get serial number", settings);
|
||||
var response = ProcessRequest<DSMInfoResponse>(requestBuilder, "get info", settings);
|
||||
|
||||
return response.Data.SerialNumber;
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
@@ -161,7 +160,9 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
{
|
||||
if (apiInfo.NeedsAuthentication)
|
||||
{
|
||||
requestBuilder.AddFormParameter("_sid", _sessionCache.Get(GenerateSessionCacheKey(settings), () => AuthenticateClient(settings), TimeSpan.FromHours(6)));
|
||||
var sid = _sessionCache.Get(GenerateSessionCacheKey(settings), () => AuthenticateClient(settings), TimeSpan.FromHours(6));
|
||||
_logger.Debug("DownloadStation Session sid={0}", sid);
|
||||
requestBuilder.AddFormParameter("_sid", sid);
|
||||
}
|
||||
|
||||
requestBuilder.AddFormParameter("api", apiInfo.Name);
|
||||
@@ -172,7 +173,9 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
{
|
||||
if (apiInfo.NeedsAuthentication)
|
||||
{
|
||||
requestBuilder.AddQueryParam("_sid", _sessionCache.Get(GenerateSessionCacheKey(settings), () => AuthenticateClient(settings), TimeSpan.FromHours(6)));
|
||||
var sid = _sessionCache.Get(GenerateSessionCacheKey(settings), () => AuthenticateClient(settings), TimeSpan.FromHours(6));
|
||||
_logger.Debug("DownloadStation Session sid={0}", sid);
|
||||
requestBuilder.AddQueryParam("_sid", sid);
|
||||
}
|
||||
|
||||
requestBuilder.AddQueryParam("api", apiInfo.Name);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using NLog;
|
||||
using NzbDrone.Common.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Common.Http;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
{
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
{
|
||||
public class ExpectedVersion
|
||||
{
|
||||
public int Version { get; set; }
|
||||
public IDiskStationProxy Proxy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
@@ -18,11 +17,17 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
|
||||
public class FileStationProxy : DiskStationProxyBase, IFileStationProxy
|
||||
{
|
||||
public FileStationProxy(IHttpClient httpClient, ICacheManager cacheManager, Logger logger)
|
||||
private IDSMInfoProvider _dsmInfoProvider;
|
||||
|
||||
public FileStationProxy(IDSMInfoProvider dsmInfoProvider,
|
||||
IHttpClient httpClient,
|
||||
ICacheManager cacheManager,
|
||||
Logger logger)
|
||||
: base(DiskStationApi.FileStationList, "SYNO.FileStation.List", httpClient, cacheManager, logger)
|
||||
{
|
||||
_dsmInfoProvider = dsmInfoProvider;
|
||||
}
|
||||
|
||||
|
||||
public SharedFolderMapping GetSharedFolderMapping(string sharedFolder, DownloadStationSettings settings)
|
||||
{
|
||||
var info = GetInfoFileOrDirectory(sharedFolder, settings);
|
||||
@@ -34,13 +39,16 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
||||
|
||||
public FileStationListFileInfoResponse GetInfoFileOrDirectory(string path, DownloadStationSettings settings)
|
||||
{
|
||||
var requestBuilder = BuildRequest(settings, "getinfo", 2);
|
||||
var dsmVersion = _dsmInfoProvider.GetDSMVersion(settings);
|
||||
|
||||
var requestBuilder = BuildRequest(settings, "getinfo", dsmVersion >= new Version(6, 0, 0) ? 2 : 1);
|
||||
requestBuilder.AddQueryParam("path", new[] { path }.ToJson());
|
||||
requestBuilder.AddQueryParam("additional", "[\"real_path\"]");
|
||||
|
||||
var response = ProcessRequest<FileStationListResponse>(requestBuilder, $"get info of {path}", settings);
|
||||
|
||||
return response.Data.Files.First();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,8 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Responses
|
||||
{
|
||||
[JsonProperty("serial")]
|
||||
public string SerialNumber { get; set; }
|
||||
|
||||
[JsonProperty("version_string")]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Common.Crypto;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
public interface ISerialNumberProvider
|
||||
{
|
||||
string GetSerialNumber(DownloadStationSettings settings);
|
||||
}
|
||||
|
||||
public class SerialNumberProvider : ISerialNumberProvider
|
||||
{
|
||||
private readonly IDSMInfoProxy _proxy;
|
||||
private ICached<string> _cache;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public SerialNumberProvider(ICacheManager cacheManager,
|
||||
IDSMInfoProxy proxy,
|
||||
Logger logger)
|
||||
{
|
||||
_proxy = proxy;
|
||||
_cache = cacheManager.GetCache<string>(GetType());
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string GetSerialNumber(DownloadStationSettings settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _cache.Get(settings.Host, () => GetHashedSerialNumber(settings), TimeSpan.FromMinutes(5));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Could not get the serial number from Download Station {0}:{1}", settings.Host, settings.Port);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetHashedSerialNumber(DownloadStationSettings settings)
|
||||
{
|
||||
var serialNumber = _proxy.GetSerialNumber(settings);
|
||||
return HashConverter.GetHash(serialNumber).ToHexString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
protected readonly IDownloadStationInfoProxy _dsInfoProxy;
|
||||
protected readonly IDownloadStationTaskProxy _dsTaskProxy;
|
||||
protected readonly ISharedFolderResolver _sharedFolderResolver;
|
||||
protected readonly ISerialNumberProvider _serialNumberProvider;
|
||||
protected readonly IDSMInfoProvider _dsmInfoProvider;
|
||||
protected readonly IFileStationProxy _fileStationProxy;
|
||||
|
||||
|
||||
public TorrentDownloadStation(ISharedFolderResolver sharedFolderResolver,
|
||||
ISerialNumberProvider serialNumberProvider,
|
||||
IDSMInfoProvider dsmInfoProvider,
|
||||
IFileStationProxy fileStationProxy,
|
||||
IDownloadStationInfoProxy dsInfoProxy,
|
||||
IDownloadStationTaskProxy dsTaskProxy,
|
||||
@@ -42,7 +42,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
_dsTaskProxy = dsTaskProxy;
|
||||
_fileStationProxy = fileStationProxy;
|
||||
_sharedFolderResolver = sharedFolderResolver;
|
||||
_serialNumberProvider = serialNumberProvider;
|
||||
_dsmInfoProvider = dsmInfoProvider;
|
||||
}
|
||||
|
||||
public override string Name => "Download Station";
|
||||
@@ -55,7 +55,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
public override IEnumerable<DownloadClientItem> GetItems()
|
||||
{
|
||||
var torrents = GetTasks();
|
||||
var serialNumber = _serialNumberProvider.GetSerialNumber(Settings);
|
||||
var serialNumber = _dsmInfoProvider.GetSerialNumber(Settings);
|
||||
|
||||
var items = new List<DownloadClientItem>();
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
|
||||
protected override string AddFromMagnetLink(RemoteEpisode remoteEpisode, string hash, string magnetLink)
|
||||
{
|
||||
var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings);
|
||||
var hashedSerialNumber = _dsmInfoProvider.GetSerialNumber(Settings);
|
||||
|
||||
_dsTaskProxy.AddTaskFromUrl(magnetLink, GetDownloadDirectory(), Settings);
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
|
||||
protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string hash, string filename, byte[] fileContent)
|
||||
{
|
||||
var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings);
|
||||
var hashedSerialNumber = _dsmInfoProvider.GetSerialNumber(Settings);
|
||||
|
||||
_dsTaskProxy.AddTaskFromData(fileContent, filename, GetDownloadDirectory(), Settings);
|
||||
|
||||
@@ -191,6 +191,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
failures.AddIfNotNull(TestDSMVersion());
|
||||
failures.AddIfNotNull(TestOutputPath());
|
||||
failures.AddIfNotNull(TestGetTorrents());
|
||||
}
|
||||
@@ -303,7 +304,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
return new NzbDroneValidationFailure(fieldName, $"Shared folder does not exist")
|
||||
{
|
||||
DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?"
|
||||
DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{downloadDir}', are you sure you specified it correctly?"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -334,7 +335,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
try
|
||||
{
|
||||
return ValidateVersion();
|
||||
return TestProxiesVersions();
|
||||
}
|
||||
catch (DownloadClientAuthenticationException ex)
|
||||
{
|
||||
@@ -363,16 +364,40 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
protected ValidationFailure ValidateVersion()
|
||||
|
||||
protected ValidationFailure TestDSMVersion()
|
||||
{
|
||||
var info = _dsTaskProxy.GetApiInfo(Settings);
|
||||
var dsmversion = _dsmInfoProvider.GetDSMVersion(Settings);
|
||||
|
||||
_logger.Debug("Download Station api version information: Min {0} - Max {1}", info.MinVersion, info.MaxVersion);
|
||||
|
||||
if (info.MinVersion > 2 || info.MaxVersion < 2)
|
||||
if (dsmversion < new Version(6, 0, 0))
|
||||
{
|
||||
return new ValidationFailure(string.Empty, $"Download Station API version not supported, should be at least 2. It supports from {info.MinVersion} to {info.MaxVersion}");
|
||||
return new NzbDroneValidationFailure(string.Empty, $"DSM Version {dsmversion} not fully supported. We recommend version 6.0.0 or above.") { IsWarning = true };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ValidationFailure TestProxiesVersions()
|
||||
{
|
||||
var dsmVersion = _dsmInfoProvider.GetDSMVersion(Settings);
|
||||
|
||||
var expectedVersions = new List<ExpectedVersion>()
|
||||
{
|
||||
new ExpectedVersion { Version = 2, Proxy = _dsTaskProxy },
|
||||
new ExpectedVersion { Version = (dsmVersion >= new Version(6,0,0))? 2 : 1, Proxy = _fileStationProxy },
|
||||
new ExpectedVersion { Version = 1, Proxy = _dsInfoProxy }
|
||||
};
|
||||
|
||||
foreach (var expectedVersion in expectedVersions)
|
||||
{
|
||||
DiskStationApiInfo apiInfo = expectedVersion.Proxy.GetApiInfo(Settings);
|
||||
|
||||
_logger.Debug("{1} api version information: Min {1} - Max {2} - Expected {3}", apiInfo.Name, apiInfo.MinVersion, apiInfo.MaxVersion, expectedVersion.Version);
|
||||
|
||||
if (apiInfo.MinVersion > expectedVersion.Version || apiInfo.MaxVersion < expectedVersion.Version)
|
||||
{
|
||||
return new NzbDroneValidationFailure(string.Empty, $"{apiInfo.Name} API version not supported, should be at least {expectedVersion.Version}. It supports from {apiInfo.MinVersion} to {apiInfo.MaxVersion}");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
protected readonly IDownloadStationInfoProxy _dsInfoProxy;
|
||||
protected readonly IDownloadStationTaskProxy _dsTaskProxy;
|
||||
protected readonly ISharedFolderResolver _sharedFolderResolver;
|
||||
protected readonly ISerialNumberProvider _serialNumberProvider;
|
||||
protected readonly IDSMInfoProvider _dsmInfoProvider;
|
||||
protected readonly IFileStationProxy _fileStationProxy;
|
||||
|
||||
public UsenetDownloadStation(ISharedFolderResolver sharedFolderResolver,
|
||||
ISerialNumberProvider serialNumberProvider,
|
||||
IDSMInfoProvider dsmInfoProvider,
|
||||
IFileStationProxy fileStationProxy,
|
||||
IDownloadStationInfoProxy dsInfoProxy,
|
||||
IDownloadStationTaskProxy dsTaskProxy,
|
||||
@@ -40,7 +40,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
_dsTaskProxy = dsTaskProxy;
|
||||
_fileStationProxy = fileStationProxy;
|
||||
_sharedFolderResolver = sharedFolderResolver;
|
||||
_serialNumberProvider = serialNumberProvider;
|
||||
_dsmInfoProvider = dsmInfoProvider;
|
||||
}
|
||||
|
||||
public override string Name => "Download Station";
|
||||
@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
public override IEnumerable<DownloadClientItem> GetItems()
|
||||
{
|
||||
var nzbTasks = GetTasks();
|
||||
var serialNumber = _serialNumberProvider.GetSerialNumber(Settings);
|
||||
var serialNumber = _dsmInfoProvider.GetSerialNumber(Settings);
|
||||
|
||||
var items = new List<DownloadClientItem>();
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
|
||||
protected override string AddFromNzbFile(RemoteEpisode remoteEpisode, string filename, byte[] fileContent)
|
||||
{
|
||||
var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings);
|
||||
var hashedSerialNumber = _dsmInfoProvider.GetSerialNumber(Settings);
|
||||
|
||||
_dsTaskProxy.AddTaskFromData(fileContent, filename, GetDownloadDirectory(), Settings);
|
||||
|
||||
@@ -186,6 +186,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
failures.AddIfNotNull(TestConnection());
|
||||
if (failures.Any()) return;
|
||||
failures.AddIfNotNull(TestDSMVersion());
|
||||
failures.AddIfNotNull(TestOutputPath());
|
||||
failures.AddIfNotNull(TestGetNZB());
|
||||
}
|
||||
@@ -217,7 +218,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
return new NzbDroneValidationFailure(fieldName, $"Shared folder does not exist")
|
||||
{
|
||||
DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?"
|
||||
DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{downloadDir}', are you sure you specified it correctly?"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -248,7 +249,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
{
|
||||
try
|
||||
{
|
||||
return ValidateVersion();
|
||||
return TestProxiesVersions();
|
||||
}
|
||||
catch (DownloadClientAuthenticationException ex)
|
||||
{
|
||||
@@ -269,24 +270,48 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
DetailedDescription = "Please verify the hostname and port."
|
||||
};
|
||||
}
|
||||
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
|
||||
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Error testing Torrent Download Station");
|
||||
return new NzbDroneValidationFailure(string.Empty, "Unknown exception: " + ex.Message);
|
||||
return new NzbDroneValidationFailure(string.Empty, $"Unknown exception: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
protected ValidationFailure ValidateVersion()
|
||||
|
||||
protected ValidationFailure TestDSMVersion()
|
||||
{
|
||||
var info = _dsTaskProxy.GetApiInfo(Settings);
|
||||
var dsmversion = _dsmInfoProvider.GetDSMVersion(Settings);
|
||||
|
||||
_logger.Debug("Download Station api version information: Min {0} - Max {1}", info.MinVersion, info.MaxVersion);
|
||||
|
||||
if (info.MinVersion > 2 || info.MaxVersion < 2)
|
||||
if (dsmversion < new Version(6, 0, 0))
|
||||
{
|
||||
return new ValidationFailure(string.Empty, $"Download Station API version not supported, should be at least 2. It supports from {info.MinVersion} to {info.MaxVersion}");
|
||||
return new NzbDroneValidationFailure(string.Empty, $"DSM Version {dsmversion} not fully supported. We recommend version 6.0.0 or above.") { IsWarning = true };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ValidationFailure TestProxiesVersions()
|
||||
{
|
||||
var dsmVersion = _dsmInfoProvider.GetDSMVersion(Settings);
|
||||
|
||||
var expectedVersions = new List<ExpectedVersion>()
|
||||
{
|
||||
new ExpectedVersion { Version = 2, Proxy = _dsTaskProxy },
|
||||
new ExpectedVersion { Version = (dsmVersion >= new Version(6,0,0))? 2 : 1, Proxy = _fileStationProxy },
|
||||
new ExpectedVersion { Version = 1, Proxy = _dsInfoProxy }
|
||||
};
|
||||
|
||||
foreach (var expectedVersion in expectedVersions)
|
||||
{
|
||||
DiskStationApiInfo apiInfo = expectedVersion.Proxy.GetApiInfo(Settings);
|
||||
|
||||
_logger.Debug("{1} api version information: Min {1} - Max {2} - Expected {3}", apiInfo.Name, apiInfo.MinVersion, apiInfo.MaxVersion, expectedVersion.Version);
|
||||
|
||||
if (apiInfo.MinVersion > expectedVersion.Version || apiInfo.MaxVersion < expectedVersion.Version)
|
||||
{
|
||||
return new NzbDroneValidationFailure(string.Empty, $"{apiInfo.Name} API version not supported, should be at least {expectedVersion.Version}. It supports from {apiInfo.MinVersion} to {apiInfo.MaxVersion}");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -377,7 +402,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new NzbDroneValidationFailure(string.Empty, "Failed to get the list of NZBs: " + ex.Message);
|
||||
return new NzbDroneValidationFailure(string.Empty, $"Failed to get the list of NZBs: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Disk;
|
||||
@@ -48,6 +48,8 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
_proxy.MoveTorrentToTopInQueue(hash.ToLower(), Settings);
|
||||
}
|
||||
|
||||
SetInitialState(hash.ToLower());
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -82,6 +84,8 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
_logger.Warn(ex, "Failed to set the torrent priority for {0}.", filename);
|
||||
}
|
||||
|
||||
SetInitialState(hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -120,7 +124,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
{
|
||||
case "error": // some error occurred, applies to paused torrents
|
||||
item.Status = DownloadItemStatus.Failed;
|
||||
item.Message = "QBittorrent is reporting an error";
|
||||
item.Message = "qBittorrent is reporting an error";
|
||||
break;
|
||||
|
||||
case "pausedDL": // torrent is paused and has NOT finished downloading
|
||||
@@ -222,7 +226,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
var config = _proxy.GetConfig(Settings);
|
||||
if (config.MaxRatioEnabled && config.RemoveOnMaxRatio)
|
||||
{
|
||||
return new NzbDroneValidationFailure(String.Empty, "QBittorrent is configured to remove torrents when they reach their Share Ratio Limit")
|
||||
return new NzbDroneValidationFailure(String.Empty, "qBittorrent is configured to remove torrents when they reach their Share Ratio Limit")
|
||||
{
|
||||
DetailedDescription = "Sonarr will be unable to perform Completed Download Handling as configured. You can fix this in qBittorrent ('Tools -> Options...' in the menu) by changing 'Options -> BitTorrent -> Share Ratio Limiting' from 'Remove them' to 'Pause them'."
|
||||
};
|
||||
@@ -306,5 +310,28 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SetInitialState(string hash)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch ((QBittorrentState)Settings.InitialState)
|
||||
{
|
||||
case QBittorrentState.ForceStart:
|
||||
_proxy.SetForceStart(hash, true, Settings);
|
||||
break;
|
||||
case QBittorrentState.Start:
|
||||
_proxy.ResumeTorrent(hash, Settings);
|
||||
break;
|
||||
case QBittorrentState.Pause:
|
||||
_proxy.PauseTorrent(hash, Settings);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Failed to set inital state for {0}.", hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using NLog;
|
||||
@@ -23,6 +23,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
void RemoveTorrent(string hash, Boolean removeData, QBittorrentSettings settings);
|
||||
void SetTorrentLabel(string hash, string label, QBittorrentSettings settings);
|
||||
void MoveTorrentToTopInQueue(string hash, QBittorrentSettings settings);
|
||||
void PauseTorrent(string hash, QBittorrentSettings settings);
|
||||
void ResumeTorrent(string hash, QBittorrentSettings settings);
|
||||
void SetForceStart(string hash, bool enabled, QBittorrentSettings settings);
|
||||
}
|
||||
|
||||
public class QBittorrentProxy : IQBittorrentProxy
|
||||
@@ -117,7 +120,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
}
|
||||
catch(DownloadClientException ex)
|
||||
{
|
||||
// if setCategory fails due to method not being found, then try older setLabel command for qbittorent < v.3.3.5
|
||||
// if setCategory fails due to method not being found, then try older setLabel command for qBittorrent < v.3.3.5
|
||||
if (ex.InnerException is HttpException && (ex.InnerException as HttpException).Response.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
var setLabelRequest = BuildRequest(settings).Resource("/command/setLabel")
|
||||
@@ -154,6 +157,34 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
|
||||
}
|
||||
|
||||
public void PauseTorrent(string hash, QBittorrentSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings).Resource("/command/pause")
|
||||
.Post()
|
||||
.AddFormParameter("hash", hash);
|
||||
|
||||
ProcessRequest(request, settings);
|
||||
}
|
||||
|
||||
public void ResumeTorrent(string hash, QBittorrentSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings).Resource("/command/resume")
|
||||
.Post()
|
||||
.AddFormParameter("hash", hash);
|
||||
|
||||
ProcessRequest(request, settings);
|
||||
}
|
||||
|
||||
public void SetForceStart(string hash, bool enabled, QBittorrentSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings).Resource("/command/setForceStart")
|
||||
.Post()
|
||||
.AddFormParameter("hashes", hash)
|
||||
.AddFormParameter("value", enabled ? "true": "false");
|
||||
|
||||
ProcessRequest(request, settings);
|
||||
}
|
||||
|
||||
private HttpRequestBuilder BuildRequest(QBittorrentSettings settings)
|
||||
{
|
||||
var requestBuilder = new HttpRequestBuilder(settings.UseSsl, settings.Host, settings.Port);
|
||||
@@ -197,12 +228,12 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new DownloadClientException("Failed to connect to qBitTorrent, check your settings.", ex);
|
||||
throw new DownloadClientException("Failed to connect to qBittorrent, check your settings.", ex);
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw new DownloadClientException("Failed to connect to qBitTorrent, please check your settings.", ex);
|
||||
throw new DownloadClientException("Failed to connect to qBittorrent, please check your settings.", ex);
|
||||
}
|
||||
|
||||
return response.Content;
|
||||
@@ -239,23 +270,23 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
_logger.Debug("qbitTorrent authentication failed.");
|
||||
if (ex.Response.StatusCode == HttpStatusCode.Forbidden)
|
||||
{
|
||||
throw new DownloadClientAuthenticationException("Failed to authenticate with qbitTorrent.", ex);
|
||||
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.", ex);
|
||||
}
|
||||
|
||||
throw new DownloadClientException("Failed to connect to qBitTorrent, please check your settings.", ex);
|
||||
throw new DownloadClientException("Failed to connect to qBittorrent, please check your settings.", ex);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw new DownloadClientUnavailableException("Failed to connect to qBitTorrent, please check your settings.", ex);
|
||||
throw new DownloadClientUnavailableException("Failed to connect to qBittorrent, please check your settings.", ex);
|
||||
}
|
||||
|
||||
if (response.Content != "Ok.") // returns "Fails." on bad login
|
||||
{
|
||||
_logger.Debug("qbitTorrent authentication failed.");
|
||||
throw new DownloadClientAuthenticationException("Failed to authenticate with qbitTorrent.");
|
||||
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.");
|
||||
}
|
||||
|
||||
_logger.Debug("qbitTorrent authentication succeeded.");
|
||||
_logger.Debug("qBittorrent authentication succeeded.");
|
||||
|
||||
cookies = response.GetCookies();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using FluentValidation;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
@@ -46,7 +46,10 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
[FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(QBittorrentPriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")]
|
||||
public int OlderTvPriority { get; set; }
|
||||
|
||||
[FieldDefinition(7, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Use a secure connection. See Options -> Web UI -> 'Use HTTPS instead of HTTP' in qBittorrent.")]
|
||||
[FieldDefinition(7, Label = "Initial State", Type = FieldType.Select, SelectOptions = typeof(QBittorrentState), HelpText = "Initial state for torrents added to qBittorrent")]
|
||||
public int InitialState { get; set; }
|
||||
|
||||
[FieldDefinition(8, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Use a secure connection. See Options -> Web UI -> 'Use HTTPS instead of HTTP' in qBittorrent.")]
|
||||
public bool UseSsl { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
{
|
||||
public enum QBittorrentState
|
||||
{
|
||||
Start = 0,
|
||||
ForceStart = 1,
|
||||
Pause = 2
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,8 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||
queueItem.CanBeRemoved = true;
|
||||
queueItem.CanMoveFiles = true;
|
||||
|
||||
if (sabQueue.Paused || sabQueueItem.Status == SabnzbdDownloadStatus.Paused)
|
||||
if ((sabQueue.Paused && sabQueueItem.Priority != SabnzbdPriority.Force) ||
|
||||
sabQueueItem.Status == SabnzbdDownloadStatus.Paused)
|
||||
{
|
||||
queueItem.Status = DownloadItemStatus.Paused;
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||
}
|
||||
|
||||
_proxy.SetState(hash, (UTorrentState)Settings.IntialState, Settings);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -65,6 +67,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||
}
|
||||
|
||||
_proxy.SetState(hash, (UTorrentState)Settings.IntialState, Settings);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||
void RemoveTorrent(string hash, bool removeData, UTorrentSettings settings);
|
||||
void SetTorrentLabel(string hash, string label, UTorrentSettings settings);
|
||||
void MoveTorrentToTopInQueue(string hash, UTorrentSettings settings);
|
||||
void SetState(string hash, UTorrentState state, UTorrentSettings settings);
|
||||
}
|
||||
|
||||
public class UTorrentProxy : IUTorrentProxy
|
||||
@@ -157,6 +158,15 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||
ProcessRequest(requestBuilder, settings);
|
||||
}
|
||||
|
||||
public void SetState(string hash, UTorrentState state, UTorrentSettings settings)
|
||||
{
|
||||
var requestBuilder = BuildRequest(settings)
|
||||
.AddQueryParam("action", state.ToString().ToLowerInvariant())
|
||||
.AddQueryParam("hash", hash);
|
||||
|
||||
ProcessRequest(requestBuilder, settings);
|
||||
}
|
||||
|
||||
private HttpRequestBuilder BuildRequest(UTorrentSettings settings)
|
||||
{
|
||||
var requestBuilder = new HttpRequestBuilder(false, settings.Host, settings.Port)
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||
[FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")]
|
||||
public int OlderTvPriority { get; set; }
|
||||
|
||||
[FieldDefinition(7, Label = "Initial State", Type = FieldType.Select, SelectOptions = typeof(UTorrentState), HelpText = "Initial state for torrents added to uTorrent")]
|
||||
public int IntialState { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
|
||||
10
src/NzbDrone.Core/Download/Clients/uTorrent/UtorrentState.cs
Normal file
10
src/NzbDrone.Core/Download/Clients/uTorrent/UtorrentState.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||
{
|
||||
public enum UTorrentState
|
||||
{
|
||||
Start = 0,
|
||||
ForceStart = 1,
|
||||
Pause = 2,
|
||||
Stop = 3
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Common.TPL;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
@@ -52,8 +53,12 @@ namespace NzbDrone.Core.Download
|
||||
|
||||
if (downloadClient == null)
|
||||
{
|
||||
_logger.Warn("{0} Download client isn't configured yet.", remoteEpisode.Release.DownloadProtocol);
|
||||
return;
|
||||
throw new DownloadClientUnavailableException($"{remoteEpisode.Release.DownloadProtocol} Download client isn't configured yet");
|
||||
}
|
||||
|
||||
if (_downloadClientStatusService.IsDisabled(downloadClient.Definition.Id))
|
||||
{
|
||||
throw new DownloadClientUnavailableException($"{downloadClient.Name} is disabled due to recent failues");
|
||||
}
|
||||
|
||||
// Limit grabs to 2 per second.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using NzbDrone.Core.Download;
|
||||
|
||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||
{
|
||||
public class FixFutureDownloadClientStatusTimes : FixFutureProviderStatusTimes<DownloadClientStatus>, IHousekeepingTask
|
||||
{
|
||||
public FixFutureDownloadClientStatusTimes(IDownloadClientStatusRepository downloadClientStatusRepository)
|
||||
: base(downloadClientStatusRepository)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using NzbDrone.Core.Indexers;
|
||||
|
||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||
{
|
||||
public class FixFutureIndexerStatusTimes : FixFutureProviderStatusTimes<IndexerStatus>, IHousekeepingTask
|
||||
{
|
||||
public FixFutureIndexerStatusTimes(IIndexerStatusRepository indexerStatusRepository)
|
||||
: base(indexerStatusRepository)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.ThingiProvider.Status;
|
||||
|
||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||
{
|
||||
public abstract class FixFutureProviderStatusTimes<TModel> where TModel : ProviderStatusBase, new()
|
||||
{
|
||||
private readonly IProviderStatusRepository<TModel> _repo;
|
||||
|
||||
protected FixFutureProviderStatusTimes(IProviderStatusRepository<TModel> repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var statuses = _repo.All().ToList();
|
||||
var toUpdate = new List<TModel>();
|
||||
|
||||
foreach (var status in statuses)
|
||||
{
|
||||
var updated = false;
|
||||
var escalationDelay = EscalationBackOff.Periods[status.EscalationLevel];
|
||||
var disabledTill = now.AddMinutes(escalationDelay);
|
||||
|
||||
if (status.DisabledTill > disabledTill)
|
||||
{
|
||||
status.DisabledTill = disabledTill;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (status.InitialFailure > now)
|
||||
{
|
||||
status.InitialFailure = now;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (status.MostRecentFailure > now)
|
||||
{
|
||||
status.MostRecentFailure = now;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
toUpdate.Add(status);
|
||||
}
|
||||
}
|
||||
|
||||
_repo.UpdateMany(toUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("[{0} : {1:yyyy-MM-dd}", Series.Title, AirDate);
|
||||
return string.Format("[{0} : {1:yyyy-MM-dd}]", Series.Title, AirDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
using NzbDrone.Core.ThingiProvider.Status;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
|
||||
@@ -343,6 +343,11 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
public static long ParseSize(string sizeString, bool defaultToBinaryPrefix)
|
||||
{
|
||||
if (sizeString.IsNullOrWhiteSpace())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sizeString.All(char.IsDigit))
|
||||
{
|
||||
return long.Parse(sizeString);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -60,7 +60,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(?:\\|\/|^)(?:extras|@eadir|extrafanart|plex versions|\.[^\\/]+)(?:\\|\/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(?:\\|\/|^)(?:extras|@eadir|extrafanart|plex versions|\.[^\\/]+)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex ExcludedFilesRegex = new Regex(@"^\._|^Thumbs\.db$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public void Scan(Series series)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -94,7 +94,18 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
|
||||
if (localEpisode.Episodes.Empty())
|
||||
{
|
||||
decision = new ImportDecision(localEpisode, new Rejection("Invalid season or episode"));
|
||||
if (localEpisode.ParsedEpisodeInfo.IsPartialSeason)
|
||||
{
|
||||
decision = new ImportDecision(localEpisode, new Rejection("Partial season packs are not supported"));
|
||||
}
|
||||
else if (localEpisode.ParsedEpisodeInfo.IsSeasonExtra)
|
||||
{
|
||||
decision = new ImportDecision(localEpisode, new Rejection("Extras are not supported"));
|
||||
}
|
||||
else
|
||||
{
|
||||
decision = new ImportDecision(localEpisode, new Rejection("Invalid season or episode"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -122,6 +133,14 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
{
|
||||
_logger.Error("Unable to make a decision on {0}", file);
|
||||
}
|
||||
else if (decision.Rejections.Any())
|
||||
{
|
||||
_logger.Debug("File rejected for the following reasons: {0}", string.Join(", ", decision.Rejections));
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("File accepted");
|
||||
}
|
||||
|
||||
return decision;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -35,11 +35,17 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
||||
return mediaInfo.AudioChannelPositionsText.ContainsIgnoreCase("LFE") ? audioChannels - 1 + 0.1m : audioChannels;
|
||||
}
|
||||
|
||||
if (audioChannelPositions.Contains("+"))
|
||||
{
|
||||
return audioChannelPositions.Split('+')
|
||||
.Sum(s => decimal.Parse(s.Trim(), CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return audioChannelPositions.Replace("Object Based / ", "")
|
||||
.Split(new string[] { " / " }, StringSplitOptions.None)
|
||||
.First()
|
||||
.Split('/')
|
||||
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
||||
.Split(new string[] { " / " }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.First()
|
||||
.Split('/')
|
||||
.Sum(s => decimal.Parse(s, CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
public static string FormatAudioCodec(MediaInfoModel mediaInfo, string sceneName)
|
||||
@@ -89,6 +95,11 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
||||
return "FLAC";
|
||||
}
|
||||
|
||||
if (audioFormat.Trim().EqualsIgnoreCase("mp3"))
|
||||
{
|
||||
return "MP3";
|
||||
}
|
||||
|
||||
if (audioFormat.EqualsIgnoreCase("MPEG Audio"))
|
||||
{
|
||||
if (mediaInfo.AudioCodecID == "55" || mediaInfo.AudioCodecID == "A_MPEG/L3" || mediaInfo.AudioProfile == "Layer 3")
|
||||
@@ -102,6 +113,11 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
||||
}
|
||||
}
|
||||
|
||||
if (audioFormat.EqualsIgnoreCase("Opus"))
|
||||
{
|
||||
return "Opus";
|
||||
}
|
||||
|
||||
if (audioFormat.EqualsIgnoreCase("PCM"))
|
||||
{
|
||||
return "PCM";
|
||||
@@ -214,7 +230,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
||||
return GetSceneNameMatch(sceneName, "AVC", "h264");
|
||||
}
|
||||
|
||||
if (videoFormat.EqualsIgnoreCase("DivX"))
|
||||
if (videoFormat.EqualsIgnoreCase("DivX") || videoFormat.EqualsIgnoreCase("div3"))
|
||||
{
|
||||
return "DivX";
|
||||
}
|
||||
@@ -267,6 +283,12 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
|
||||
return "VC1";
|
||||
}
|
||||
|
||||
if (videoFormat.EqualsIgnoreCase("VP6") || videoFormat.EqualsIgnoreCase("VP7") ||
|
||||
videoFormat.EqualsIgnoreCase("VP8") || videoFormat.EqualsIgnoreCase("VP9"))
|
||||
{
|
||||
return videoFormat.ToUpperInvariant();
|
||||
}
|
||||
|
||||
if (videoFormat == "WMV2")
|
||||
{
|
||||
return "WMV";
|
||||
|
||||
@@ -371,7 +371,9 @@
|
||||
<Compile Include="Download\Clients\DownloadClientAuthenticationException.cs" />
|
||||
<Compile Include="Download\Clients\DownloadClientUnavailableException.cs" />
|
||||
<Compile Include="Download\Clients\DownloadClientException.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\DSMInfoProvider.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\Proxies\DownloadStationInfoProxy.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\Proxies\ExpectedVersion.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\TorrentDownloadStation.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\Proxies\DownloadStationTaskProxy.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\DownloadStationSettings.cs" />
|
||||
@@ -390,7 +392,6 @@
|
||||
<Compile Include="Download\Clients\DownloadStation\Responses\DiskStationResponse.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\Responses\DownloadStationTaskInfoResponse.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\DiskStationApiInfo.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\SerialNumberProvider.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\SharedFolderMapping.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\SharedFolderResolver.cs" />
|
||||
<Compile Include="Download\Clients\DownloadStation\DiskStationApi.cs" />
|
||||
@@ -444,6 +445,7 @@
|
||||
<Compile Include="Download\Clients\Pneumatic\Pneumatic.cs" />
|
||||
<Compile Include="Download\Clients\Pneumatic\PneumaticSettings.cs" />
|
||||
<Compile Include="Download\Clients\QBittorrent\QBittorrentPreferences.cs" />
|
||||
<Compile Include="Download\Clients\QBittorrent\QBittorrentState.cs" />
|
||||
<Compile Include="Download\Clients\rTorrent\RTorrentDirectoryValidator.cs" />
|
||||
<Compile Include="Download\Clients\QBittorrent\QBittorrent.cs" />
|
||||
<Compile Include="Download\Clients\QBittorrent\QBittorrentPriority.cs" />
|
||||
@@ -495,6 +497,7 @@
|
||||
<Compile Include="Download\Clients\uTorrent\UTorrentProxy.cs" />
|
||||
<Compile Include="Download\Clients\uTorrent\UTorrentResponse.cs" />
|
||||
<Compile Include="Download\Clients\uTorrent\UTorrentSettings.cs" />
|
||||
<Compile Include="Download\Clients\uTorrent\UtorrentState.cs" />
|
||||
<Compile Include="Download\Clients\uTorrent\UTorrentTorrent.cs" />
|
||||
<Compile Include="Download\Clients\uTorrent\UTorrentTorrentCache.cs" />
|
||||
<Compile Include="Download\Clients\uTorrent\UTorrentTorrentStatus.cs" />
|
||||
@@ -606,6 +609,9 @@
|
||||
<Compile Include="Housekeeping\Housekeepers\CleanupUnusedTags.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\CleanupOrphanedPendingReleases.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\DeleteBadMediaCovers.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureDownloadClientStatusTimes.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureProviderStatusTimes.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureIndexerStatusTimes.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\FixFutureRunScheduledTasks.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\TrimLogDatabase.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\UpdateCleanTitleForSeries.cs" />
|
||||
@@ -1107,6 +1113,7 @@
|
||||
<Compile Include="ThingiProvider\ProviderFactory.cs" />
|
||||
<Compile Include="ThingiProvider\ProviderMessage.cs" />
|
||||
<Compile Include="ThingiProvider\ProviderRepository.cs" />
|
||||
<Compile Include="ThingiProvider\Status\EscalationBackOff.cs" />
|
||||
<Compile Include="ThingiProvider\Status\ProviderStatusBase.cs" />
|
||||
<Compile Include="ThingiProvider\Status\ProviderStatusRepository.cs" />
|
||||
<Compile Include="ThingiProvider\Status\ProviderStatusServiceBase.cs" />
|
||||
|
||||
@@ -28,7 +28,10 @@ namespace NzbDrone.Core.Parser
|
||||
// new IsoLanguage("nl", "nld", Language.Flemish),
|
||||
new IsoLanguage("el", "ell", Language.Greek),
|
||||
new IsoLanguage("ko", "kor", Language.Korean),
|
||||
new IsoLanguage("hu", "hun", Language.Hungarian)
|
||||
new IsoLanguage("hu", "hun", Language.Hungarian),
|
||||
new IsoLanguage("he", "heb", Language.Hebrew),
|
||||
new IsoLanguage("lt", "lit", Language.Lithuanian),
|
||||
new IsoLanguage("cs", "ces", Language.Czech)
|
||||
};
|
||||
|
||||
public static IsoLanguage Find(string isoCode)
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
Flemish = 19,
|
||||
Greek = 20,
|
||||
Korean = 21,
|
||||
Hungarian = 22
|
||||
Hungarian = 22,
|
||||
Hebrew = 23,
|
||||
Lithuanian = 24,
|
||||
Czech = 25
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,13 @@ namespace NzbDrone.Core.Parser
|
||||
{
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(LanguageParser));
|
||||
|
||||
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\b(?:ita|italian)\b)|(?<german>german\b|videomann)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?<russian>\brus\b)|(?<dutch>nl\W?subs?)|(?<hungarian>\b(?:HUNDUB|HUN)\b)",
|
||||
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\b(?:ita|italian)\b)|(?<german>german\b|videomann)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?<russian>\brus\b)|(?<dutch>nl\W?subs?)|(?<hungarian>\b(?:HUNDUB|HUN)\b)|(?<hebrew>\bHebDub\b)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?<lithuanian>\bLT\b)|(?<czech>\bCZ\b)",
|
||||
RegexOptions.Compiled);
|
||||
|
||||
|
||||
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static Language ParseLanguage(string title)
|
||||
@@ -77,31 +81,15 @@ namespace NzbDrone.Core.Parser
|
||||
if (lowerTitle.Contains("hungarian"))
|
||||
return Language.Hungarian;
|
||||
|
||||
var match = LanguageRegex.Match(title);
|
||||
if (lowerTitle.Contains("hebrew"))
|
||||
return Language.Hebrew;
|
||||
|
||||
if (match.Groups["italian"].Captures.Cast<Capture>().Any())
|
||||
return Language.Italian;
|
||||
var regexLanguage = RegexLanguage(title);
|
||||
|
||||
if (match.Groups["german"].Captures.Cast<Capture>().Any())
|
||||
return Language.German;
|
||||
|
||||
if (match.Groups["flemish"].Captures.Cast<Capture>().Any())
|
||||
return Language.Flemish;
|
||||
|
||||
if (match.Groups["greek"].Captures.Cast<Capture>().Any())
|
||||
return Language.Greek;
|
||||
|
||||
if (match.Groups["french"].Success)
|
||||
return Language.French;
|
||||
|
||||
if (match.Groups["russian"].Success)
|
||||
return Language.Russian;
|
||||
|
||||
if (match.Groups["dutch"].Success)
|
||||
return Language.Dutch;
|
||||
|
||||
if (match.Groups["hungarian"].Success)
|
||||
return Language.Hungarian;
|
||||
if (regexLanguage != Language.Unknown)
|
||||
{
|
||||
return regexLanguage;
|
||||
}
|
||||
|
||||
return Language.English;
|
||||
}
|
||||
@@ -140,5 +128,49 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
return Language.Unknown;
|
||||
}
|
||||
|
||||
private static Language RegexLanguage(string title)
|
||||
{
|
||||
// Case sensitive
|
||||
var caseSensitiveMatch = CaseSensitiveLanguageRegex.Match(title);
|
||||
|
||||
if (caseSensitiveMatch.Groups["lithuanian"].Captures.Cast<Capture>().Any())
|
||||
return Language.Lithuanian;
|
||||
|
||||
if (caseSensitiveMatch.Groups["czech"].Captures.Cast<Capture>().Any())
|
||||
return Language.Czech;
|
||||
|
||||
// Case insensitive
|
||||
var match = LanguageRegex.Match(title);
|
||||
|
||||
if (match.Groups["italian"].Captures.Cast<Capture>().Any())
|
||||
return Language.Italian;
|
||||
|
||||
if (match.Groups["german"].Captures.Cast<Capture>().Any())
|
||||
return Language.German;
|
||||
|
||||
if (match.Groups["flemish"].Captures.Cast<Capture>().Any())
|
||||
return Language.Flemish;
|
||||
|
||||
if (match.Groups["greek"].Captures.Cast<Capture>().Any())
|
||||
return Language.Greek;
|
||||
|
||||
if (match.Groups["french"].Success)
|
||||
return Language.French;
|
||||
|
||||
if (match.Groups["russian"].Success)
|
||||
return Language.Russian;
|
||||
|
||||
if (match.Groups["dutch"].Success)
|
||||
return Language.Dutch;
|
||||
|
||||
if (match.Groups["hungarian"].Success)
|
||||
return Language.Hungarian;
|
||||
|
||||
if (match.Groups["hebrew"].Success)
|
||||
return Language.Hebrew;
|
||||
|
||||
return Language.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,12 @@ namespace NzbDrone.Core.Parser.Model
|
||||
public string AirDate { get; set; }
|
||||
public Language Language { get; set; }
|
||||
public bool FullSeason { get; set; }
|
||||
public bool IsPartialSeason { get; set; }
|
||||
public bool IsSeasonExtra { get; set; }
|
||||
public bool Special { get; set; }
|
||||
public string ReleaseGroup { get; set; }
|
||||
public string ReleaseHash { get; set; }
|
||||
public int SeasonPart { get; set; }
|
||||
|
||||
public ParsedEpisodeInfo()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -94,6 +94,10 @@ namespace NzbDrone.Core.Parser
|
||||
new Regex(@"^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+(?<season>(?<!\d+)(?:\d{4})(?!\d+))(?:x|\Wx|_){1,2}(?<episode>\d{2,3}(?!\d+))(?:(?:\-|x|\Wx|_){1,2}(?<episode>\d{2,3}(?!\d+)))*)\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
// Partial season pack
|
||||
new Regex(@"^(?<title>.+?)(?:\W+S(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))\W+(?:(?:Part\W?|(?<!\d+\W+)e)(?<seasonpart>\d{1,2}(?!\d+)))+)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//Mini-Series with year in title, treated as season 1, episodes are labelled as Part01, Part 01, Part.1
|
||||
new Regex(@"^(?<title>.+?\d{4})(?:\W+(?:(?:Part\W?|e)(?<episode>\d{1,2}(?!\d+)))+)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
@@ -355,7 +359,7 @@ namespace NzbDrone.Core.Parser
|
||||
Logger.Trace(regex);
|
||||
try
|
||||
{
|
||||
var result = ParseMatchCollection(match, title);
|
||||
var result = ParseMatchCollection(match, releaseTitle);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
@@ -598,11 +602,26 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
if (!episodeCaptures.Any() && !absoluteEpisodeCaptures.Any())
|
||||
{
|
||||
//Check to see if this is an "Extras" or "SUBPACK" release, if it is, return NULL
|
||||
//Todo: Set a "Extras" flag in EpisodeParseResult if we want to download them ever
|
||||
if (!matchCollection[0].Groups["extras"].Value.IsNullOrWhiteSpace()) return null;
|
||||
//Check to see if this is an "Extras" or "SUBPACK" release, if it is, set
|
||||
// IsSeasonExtra so they can be filtered out
|
||||
if (!matchCollection[0].Groups["extras"].Value.IsNullOrWhiteSpace())
|
||||
{
|
||||
result.IsSeasonExtra = true;
|
||||
}
|
||||
|
||||
result.FullSeason = true;
|
||||
// Partial season packs will have a seasonpart group so they can be differentiated
|
||||
// from a full season/single episode release
|
||||
var seasonPart = matchCollection[0].Groups["seasonpart"].Value;
|
||||
|
||||
if (seasonPart.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
result.SeasonPart = Convert.ToInt32(seasonPart);
|
||||
result.IsPartialSeason = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.FullSeason = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
private static readonly Regex SourceRegex = new Regex(@"\b(?:
|
||||
(?<bluray>BluRay|Blu-Ray|HDDVD|BD)|
|
||||
(?<webdl>WEB[-_. ]DL|WEBDL|WebRip|iTunesHD|WebHD|[. ]WEB[. ](?:[xh]26[45]|DD5[. ]1)|\d+0p[. ]WEB[. ])|
|
||||
(?<webdl>WEB[-_. ]DL|WEBDL|WebRip|AmazonHD|iTunesHD|NetflixU?HD|WebHD|[. ]WEB[. ](?:[xh]26[45]|DD5[. ]1)|\d+0p[. ]WEB[. ])|
|
||||
(?<hdtv>HDTV)|
|
||||
(?<bdrip>BDRip)|
|
||||
(?<brrip>BRRip)|
|
||||
@@ -40,7 +40,7 @@ namespace NzbDrone.Core.Parser
|
||||
private static readonly Regex RealRegex = new Regex(@"\b(?<real>REAL)\b",
|
||||
RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R480p>480p|640x480|848x480)|(?<R576p>576p)|(?<R720p>720p|1280x720)|(?<R1080p>1080p|1920x1080)|(?<R2160p>2160p))\b",
|
||||
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R480p>480p|640x480|848x480)|(?<R576p>576p)|(?<R720p>720p|1280x720)|(?<R1080p>1080p|1920x1080)|(?<R2160p>2160p|4k[-_. ]UHD|UHD[-_. ]4k))\b",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>Xvid)|(?<divx>divx))\b",
|
||||
|
||||
18
src/NzbDrone.Core/ThingiProvider/Status/EscalationBackOff.cs
Normal file
18
src/NzbDrone.Core/ThingiProvider/Status/EscalationBackOff.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace NzbDrone.Core.ThingiProvider.Status
|
||||
{
|
||||
public static class EscalationBackOff
|
||||
{
|
||||
public static readonly int[] Periods =
|
||||
{
|
||||
0,
|
||||
5 * 60,
|
||||
15 * 60,
|
||||
30 * 60,
|
||||
60 * 60,
|
||||
3 * 60 * 60,
|
||||
6 * 60 * 60,
|
||||
12 * 60 * 60,
|
||||
24 * 60 * 60
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.ThingiProvider.Status
|
||||
@@ -11,6 +10,7 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
public interface IProviderStatusServiceBase<TModel>
|
||||
where TModel : ProviderStatusBase, new()
|
||||
{
|
||||
bool IsDisabled(int providerId);
|
||||
List<TModel> GetBlockedProviders();
|
||||
void RecordSuccess(int providerId);
|
||||
void RecordFailure(int providerId, TimeSpan minimumBackOff = default(TimeSpan));
|
||||
@@ -21,25 +21,13 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
where TProvider : IProvider
|
||||
where TModel : ProviderStatusBase, new()
|
||||
{
|
||||
private static readonly int[] EscalationBackOffPeriods = {
|
||||
0,
|
||||
5 * 60,
|
||||
15 * 60,
|
||||
30 * 60,
|
||||
60 * 60,
|
||||
3 * 60 * 60,
|
||||
6 * 60 * 60,
|
||||
12 * 60 * 60,
|
||||
24 * 60 * 60
|
||||
};
|
||||
|
||||
protected readonly object _syncRoot = new object();
|
||||
|
||||
protected readonly IProviderStatusRepository<TModel> _providerStatusRepository;
|
||||
protected readonly IEventAggregator _eventAggregator;
|
||||
protected readonly Logger _logger;
|
||||
|
||||
protected int MaximumEscalationLevel { get; set; } = EscalationBackOffPeriods.Length - 1;
|
||||
protected int MaximumEscalationLevel { get; set; } = EscalationBackOff.Periods.Length - 1;
|
||||
protected TimeSpan MinimumTimeSinceInitialFailure { get; set; } = TimeSpan.Zero;
|
||||
|
||||
public ProviderStatusServiceBase(IProviderStatusRepository<TModel> providerStatusRepository, IEventAggregator eventAggregator, Logger logger)
|
||||
@@ -49,6 +37,11 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public bool IsDisabled(int providerId)
|
||||
{
|
||||
return GetProviderStatus(providerId).IsDisabled();
|
||||
}
|
||||
|
||||
public virtual List<TModel> GetBlockedProviders()
|
||||
{
|
||||
return _providerStatusRepository.All().Where(v => v.IsDisabled()).ToList();
|
||||
@@ -63,7 +56,7 @@ namespace NzbDrone.Core.ThingiProvider.Status
|
||||
{
|
||||
var level = Math.Min(MaximumEscalationLevel, status.EscalationLevel);
|
||||
|
||||
return TimeSpan.FromSeconds(EscalationBackOffPeriods[level]);
|
||||
return TimeSpan.FromSeconds(EscalationBackOff.Periods[level]);
|
||||
}
|
||||
|
||||
public virtual void RecordSuccess(int providerId)
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace NzbDrone.Core.Tv
|
||||
_episodeService.UpdateEpisodes(episodes);
|
||||
}
|
||||
|
||||
_seriesService.UpdateSeries(series);
|
||||
_seriesService.UpdateSeries(series, false);
|
||||
}
|
||||
|
||||
private void ToggleEpisodesMonitoredState(IEnumerable<Episode> episodes, bool monitored)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace NzbDrone.Core.Tv
|
||||
Series FindByTitleInexact(string title);
|
||||
void DeleteSeries(int seriesId, bool deleteFiles);
|
||||
List<Series> GetAllSeries();
|
||||
Series UpdateSeries(Series series);
|
||||
Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true);
|
||||
List<Series> UpdateSeries(List<Series> series);
|
||||
bool SeriesPathExists(string folder);
|
||||
void RemoveAddOptions(Series series);
|
||||
@@ -144,7 +144,9 @@ namespace NzbDrone.Core.Tv
|
||||
return _seriesRepository.All().ToList();
|
||||
}
|
||||
|
||||
public Series UpdateSeries(Series series)
|
||||
// updateEpisodesToMatchSeason is an override for EpisodeMonitoredService to use so a change via Season pass doesn't get nuked by the seasons loop.
|
||||
// TODO: Remove when seasons are split from series (or we come up with a better way to address this)
|
||||
public Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true)
|
||||
{
|
||||
var storedSeries = GetSeries(series.Id);
|
||||
|
||||
@@ -152,7 +154,7 @@ namespace NzbDrone.Core.Tv
|
||||
{
|
||||
var storedSeason = storedSeries.Seasons.SingleOrDefault(s => s.SeasonNumber == season.SeasonNumber);
|
||||
|
||||
if (storedSeason != null && season.Monitored != storedSeason.Monitored)
|
||||
if (storedSeason != null && season.Monitored != storedSeason.Monitored && updateEpisodesToMatchSeason)
|
||||
{
|
||||
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace NzbDrone.Host.AccessControl
|
||||
}
|
||||
|
||||
private List<UrlAcl> InternalUrls { get; }
|
||||
private List<UrlAcl> RegisteredUrls { get; }
|
||||
private List<UrlAcl> RegisteredUrls { get; set; }
|
||||
|
||||
private static readonly Regex UrlAclRegex = new Regex(@"(?<scheme>https?)\:\/\/(?<address>.+?)\:(?<port>\d+)/(?<urlbase>.+)?", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
@@ -49,11 +49,16 @@ namespace NzbDrone.Host.AccessControl
|
||||
_logger = logger;
|
||||
|
||||
InternalUrls = new List<UrlAcl>();
|
||||
RegisteredUrls = GetRegisteredUrls();
|
||||
RegisteredUrls = new List<UrlAcl>();
|
||||
}
|
||||
|
||||
public void ConfigureUrls()
|
||||
{
|
||||
if (RegisteredUrls.Empty())
|
||||
{
|
||||
GetRegisteredUrls();
|
||||
}
|
||||
|
||||
var localHostHttpUrls = BuildUrlAcls("http", "localhost", _configFileProvider.Port);
|
||||
var interfaceHttpUrls = BuildUrlAcls("http", _configFileProvider.BindAddress, _configFileProvider.Port);
|
||||
|
||||
@@ -128,19 +133,24 @@ namespace NzbDrone.Host.AccessControl
|
||||
c.UrlBase == urlAcl.UrlBase);
|
||||
}
|
||||
|
||||
private List<UrlAcl> GetRegisteredUrls()
|
||||
private void GetRegisteredUrls()
|
||||
{
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
return new List<UrlAcl>();
|
||||
return;
|
||||
}
|
||||
|
||||
if (RegisteredUrls.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var arguments = string.Format("http show urlacl");
|
||||
var output = _netshProvider.Run(arguments);
|
||||
|
||||
if (output == null || !output.Standard.Any()) return new List<UrlAcl>();
|
||||
if (output == null || !output.Standard.Any()) return;
|
||||
|
||||
return output.Standard.Select(line =>
|
||||
RegisteredUrls = output.Standard.Select(line =>
|
||||
{
|
||||
var match = UrlAclRegex.Match(line.Content);
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ServiceProcess;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Host.Owin;
|
||||
@@ -22,6 +24,7 @@ namespace NzbDrone.Host
|
||||
private readonly IHostController _hostController;
|
||||
private readonly IStartupContext _startupContext;
|
||||
private readonly IBrowserService _browserService;
|
||||
private readonly IContainer _container;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public NzbDroneServiceFactory(IConfigFileProvider configFileProvider,
|
||||
@@ -29,6 +32,7 @@ namespace NzbDrone.Host
|
||||
IRuntimeInfo runtimeInfo,
|
||||
IStartupContext startupContext,
|
||||
IBrowserService browserService,
|
||||
IContainer container,
|
||||
Logger logger)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
@@ -36,6 +40,7 @@ namespace NzbDrone.Host
|
||||
_runtimeInfo = runtimeInfo;
|
||||
_startupContext = startupContext;
|
||||
_browserService = browserService;
|
||||
_container = container;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -52,6 +57,7 @@ namespace NzbDrone.Host
|
||||
}
|
||||
|
||||
_runtimeInfo.IsExiting = false;
|
||||
DbFactory.RegisterDatabase(_container);
|
||||
_hostController.StartServer();
|
||||
|
||||
if (!_startupContext.Flags.Contains(StartupContext.NO_BROWSER)
|
||||
@@ -93,4 +99,4 @@ namespace NzbDrone.Host
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using NLog;
|
||||
@@ -9,7 +9,6 @@ using NzbDrone.Common.Instrumentation;
|
||||
using NzbDrone.Common.Processes;
|
||||
using NzbDrone.Common.Security;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
|
||||
namespace NzbDrone.Host
|
||||
@@ -76,7 +75,6 @@ namespace NzbDrone.Host
|
||||
EnsureSingleInstance(applicationModes == ApplicationModes.Service, startupContext);
|
||||
}
|
||||
|
||||
DbFactory.RegisterDatabase(_container);
|
||||
_container.Resolve<Router>().Route(applicationModes);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using NLog;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
||||
namespace NzbDrone.Host
|
||||
{
|
||||
@@ -8,14 +9,19 @@ namespace NzbDrone.Host
|
||||
private readonly INzbDroneServiceFactory _nzbDroneServiceFactory;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IConsoleService _consoleService;
|
||||
private readonly IRuntimeInfo _runtimeInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
|
||||
IConsoleService consoleService, Logger logger)
|
||||
public Router(INzbDroneServiceFactory nzbDroneServiceFactory,
|
||||
IServiceProvider serviceProvider,
|
||||
IConsoleService consoleService,
|
||||
IRuntimeInfo runtimeInfo,
|
||||
Logger logger)
|
||||
{
|
||||
_nzbDroneServiceFactory = nzbDroneServiceFactory;
|
||||
_serviceProvider = serviceProvider;
|
||||
_consoleService = consoleService;
|
||||
_runtimeInfo = runtimeInfo;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -28,14 +34,18 @@ namespace NzbDrone.Host
|
||||
case ApplicationModes.Service:
|
||||
{
|
||||
_logger.Debug("Service selected");
|
||||
|
||||
_serviceProvider.Run(_nzbDroneServiceFactory.Build());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case ApplicationModes.Interactive:
|
||||
{
|
||||
_logger.Debug("Console selected");
|
||||
_logger.Debug(_runtimeInfo.IsWindowsTray ? "Tray selected" : "Console selected");
|
||||
|
||||
_nzbDroneServiceFactory.Start();
|
||||
|
||||
break;
|
||||
}
|
||||
case ApplicationModes.InstallService:
|
||||
|
||||
@@ -3,42 +3,11 @@ using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class WantedFixture : IntegrationTest
|
||||
public class CutoffUnmetFixture : IntegrationTest
|
||||
{
|
||||
[Test, Order(0)]
|
||||
public void missing_should_be_empty()
|
||||
{
|
||||
EnsureNoSeries(266189, "The Blacklist");
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_monitored_items()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_series()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.First().Series.Should().NotBeNull();
|
||||
result.Records.First().Series.Title.Should().Be("The Blacklist");
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_have_monitored_items()
|
||||
{
|
||||
@@ -51,16 +20,6 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_unmonitored_items()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_not_have_unmonitored_items()
|
||||
{
|
||||
@@ -86,16 +45,6 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
result.Records.First().Series.Title.Should().Be("The Blacklist");
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_unmonitored_items()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc", "monitored", "false");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void cutoff_should_have_unmonitored_items()
|
||||
{
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MissingFixture : IntegrationTest
|
||||
{
|
||||
[Test, Order(0)]
|
||||
public void missing_should_be_empty()
|
||||
{
|
||||
EnsureNoSeries(266189, "The Blacklist");
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_monitored_items()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_series()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.First().Series.Should().NotBeNull();
|
||||
result.Records.First().Series.Title.Should().Be("The Blacklist");
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_unmonitored_items()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_unmonitored_items()
|
||||
{
|
||||
EnsureSeries(266189, "The Blacklist", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc", "monitored", "false");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,8 @@
|
||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||
<Compile Include="ApiTests\ReleasePushFixture.cs" />
|
||||
<Compile Include="ApiTests\SeriesLookupFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedTests\CutoffUnmetFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedTests\MissingFixture.cs" />
|
||||
<Compile Include="Client\ClientBase.cs" />
|
||||
<Compile Include="Client\EpisodeClient.cs" />
|
||||
<Compile Include="Client\IndexerClient.cs" />
|
||||
|
||||
@@ -40,24 +40,15 @@ namespace NzbDrone.Mono.Disk
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
try
|
||||
{
|
||||
var mount = GetMount(path);
|
||||
var mount = GetMount(path);
|
||||
|
||||
if (mount == null)
|
||||
{
|
||||
Logger.Debug("Unable to get free space for '{0}', unable to find suitable drive", path);
|
||||
return null;
|
||||
}
|
||||
|
||||
return mount.AvailableFreeSpace;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
if (mount == null)
|
||||
{
|
||||
Logger.Error(ex, "Couldn't get free space for {0}", path);
|
||||
Logger.Debug("Unable to get free space for '{0}', unable to find suitable drive", path);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
return mount.AvailableFreeSpace;
|
||||
}
|
||||
|
||||
public override void InheritFolderPermissions(string filename)
|
||||
@@ -100,20 +91,9 @@ namespace NzbDrone.Mono.Disk
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
try
|
||||
{
|
||||
var mount = GetMount(path);
|
||||
var mount = GetMount(path);
|
||||
|
||||
if (mount == null) return null;
|
||||
|
||||
return mount.TotalSize;
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Logger.Error(e, "Couldn't get total space for {0}", path);
|
||||
}
|
||||
|
||||
return null;
|
||||
return mount?.TotalSize;
|
||||
}
|
||||
|
||||
public override bool TryCreateHardLink(string source, string destination)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user