1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Fixed: Torrent Blackhole client will not track torrents by hash

This commit is contained in:
Mark McDowall 2015-10-15 23:11:48 -07:00
parent 20df619ddd
commit d170c9ad07
4 changed files with 15 additions and 12 deletions

View File

@ -196,5 +196,13 @@ public void should_return_status_with_outputdirs()
result.OutputRootFolders.Should().NotBeNull();
result.OutputRootFolders.First().Should().Be(_completedDownloadFolder);
}
[Test]
public void should_return_null_hash()
{
var remoteEpisode = CreateRemoteEpisode();
Subject.Download(remoteEpisode).Should().BeNull();
}
}
}

View File

@ -53,7 +53,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string
_logger.Debug("Torrent Download succeeded, saved to: {0}", filepath);
return hash;
return null;
}
public override string Name

View File

@ -11,6 +11,7 @@
using NzbDrone.Core.Validation;
using FluentValidation.Results;
using NzbDrone.Core.Download.Clients.rTorrent;
using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.RemotePathMappings;
using NzbDrone.Core.ThingiProvider;
@ -85,8 +86,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string
_logger.Debug("rTorrent could not add file");
RemoveItem(hash, true);
return null;
throw new ReleaseDownloadException(remoteEpisode.Release, "Downloading torrent failed");
}
}

View File

@ -85,11 +85,6 @@ public override string Download(RemoteEpisode remoteEpisode)
hash = DownloadFromWebUrl(remoteEpisode, torrentUrl);
}
if (hash == null)
{
throw new ReleaseDownloadException(remoteEpisode.Release, "Downloading torrent failed");
}
return hash;
}
@ -147,9 +142,9 @@ private string DownloadFromWebUrl(RemoteEpisode remoteEpisode, string torrentUrl
var hash = _torrentFileInfoReader.GetHashFromTorrentFile(torrentFile);
var actualHash = AddFromTorrentFile(remoteEpisode, hash, filename, torrentFile);
if (hash != actualHash)
if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash)
{
_logger.Warn(
_logger.Debug(
"{0} did not return the expected InfoHash for '{1}', Sonarr could potentially lose track of the download in progress.",
Definition.Implementation, remoteEpisode.Release.DownloadUrl);
}
@ -179,9 +174,9 @@ private string DownloadFromMagnetUrl(RemoteEpisode remoteEpisode, string magnetU
actualHash = AddFromMagnetLink(remoteEpisode, hash, magnetUrl);
}
if (hash != actualHash)
if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash)
{
_logger.Warn(
_logger.Debug(
"{0} did not return the expected InfoHash for '{1}', Sonarr could potentially lose track of the download in progress.",
Definition.Implementation, remoteEpisode.Release.DownloadUrl);
}