New: Drone now uses the Download Client API to determine if a download is ready for import. (User configuration is required to replace the drone factory with this feature)
parent
dcb586b937
commit
2035fe8578
@ -0,0 +1,118 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Linq;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using FluentAssertions;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Common.Disk;
|
||||||
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.Download.Clients;
|
||||||
|
using NzbDrone.Core.Download.Clients.UsenetBlackhole;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||||
|
{
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
public class UsenetBlackholeFixture : DownloadClientFixtureBase<UsenetBlackhole>
|
||||||
|
{
|
||||||
|
protected string _completedDownloadFolder;
|
||||||
|
protected string _blackholeFolder;
|
||||||
|
protected string _filePath;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
_completedDownloadFolder = @"c:\blackhole\completed".AsOsAgnostic();
|
||||||
|
_blackholeFolder = @"c:\blackhole\nzb".AsOsAgnostic();
|
||||||
|
_filePath = (@"c:\blackhole\nzb\" + _title + ".nzb").AsOsAgnostic();
|
||||||
|
|
||||||
|
Subject.Definition = new DownloadClientDefinition();
|
||||||
|
Subject.Definition.Settings = new UsenetBlackholeSettings
|
||||||
|
{
|
||||||
|
NzbFolder = _blackholeFolder,
|
||||||
|
WatchFolder = _completedDownloadFolder
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WithSuccessfulDownload()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WithFailedDownload()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IHttpProvider>()
|
||||||
|
.Setup(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()))
|
||||||
|
.Throws(new WebException());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void GivenCompletedItem()
|
||||||
|
{
|
||||||
|
var targetDir = Path.Combine(_completedDownloadFolder, _title);
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(c => c.GetDirectories(_completedDownloadFolder))
|
||||||
|
.Returns(new[] { targetDir });
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(c => c.GetFiles(targetDir, SearchOption.AllDirectories))
|
||||||
|
.Returns(new[] { Path.Combine(_completedDownloadFolder, "somefile.mkv") });
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(c => c.GetFileSize(It.IsAny<string>()))
|
||||||
|
.Returns(1000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void completed_download_should_have_required_properties()
|
||||||
|
{
|
||||||
|
GivenCompletedItem();
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
VerifyCompleted(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Download_should_download_file_if_it_doesnt_exist()
|
||||||
|
{
|
||||||
|
var remoteEpisode = CreateRemoteEpisode();
|
||||||
|
|
||||||
|
Subject.Download(remoteEpisode);
|
||||||
|
|
||||||
|
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(_downloadUrl, _filePath), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Download_should_replace_illegal_characters_in_title()
|
||||||
|
{
|
||||||
|
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
|
||||||
|
var expectedFilename = Path.Combine(_blackholeFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV]" + Path.GetExtension(_filePath));
|
||||||
|
|
||||||
|
var remoteEpisode = CreateRemoteEpisode();
|
||||||
|
remoteEpisode.Release.Title = illegalTitle;
|
||||||
|
|
||||||
|
Subject.Download(remoteEpisode);
|
||||||
|
|
||||||
|
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetItems_should_considered_locked_files_downloading()
|
||||||
|
{
|
||||||
|
GivenCompletedItem();
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(c => c.IsFileLocked(It.IsAny<string>()))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
result.Status.Should().Be(DownloadItemStatus.Downloading);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,74 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Common;
|
|
||||||
using NzbDrone.Common.Disk;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.Download;
|
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Download.Clients.Blackhole;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
using NzbDrone.Test.Common;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class BlackholeProviderFixture : CoreTest<Blackhole>
|
|
||||||
{
|
|
||||||
private const string _nzbUrl = "http://www.nzbs.com/url";
|
|
||||||
private const string _title = "some_nzb_title";
|
|
||||||
private string _blackHoleFolder;
|
|
||||||
private string _nzbPath;
|
|
||||||
private RemoteEpisode _remoteEpisode;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
_blackHoleFolder = @"c:\nzb\blackhole\".AsOsAgnostic();
|
|
||||||
_nzbPath = @"c:\nzb\blackhole\some_nzb_title.nzb".AsOsAgnostic();
|
|
||||||
|
|
||||||
_remoteEpisode = new RemoteEpisode();
|
|
||||||
_remoteEpisode.Release = new ReleaseInfo();
|
|
||||||
_remoteEpisode.Release.Title = _title;
|
|
||||||
_remoteEpisode.Release.DownloadUrl = _nzbUrl;
|
|
||||||
|
|
||||||
Subject.Definition = new DownloadClientDefinition();
|
|
||||||
Subject.Definition.Settings = new FolderSettings
|
|
||||||
{
|
|
||||||
Folder = _blackHoleFolder
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithExistingFile()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<IDiskProvider>().Setup(c => c.FileExists(_nzbPath)).Returns(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithFailedDownload()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<IHttpProvider>().Setup(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>())).Throws(new WebException());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void DownloadNzb_should_download_file_if_it_doesnt_exist()
|
|
||||||
{
|
|
||||||
Subject.DownloadNzb(_remoteEpisode);
|
|
||||||
|
|
||||||
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_replace_illegal_characters_in_title()
|
|
||||||
{
|
|
||||||
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
|
|
||||||
var expectedFilename = Path.Combine(_blackHoleFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb");
|
|
||||||
_remoteEpisode.Release.Title = illegalTitle;
|
|
||||||
|
|
||||||
Subject.DownloadNzb(_remoteEpisode);
|
|
||||||
|
|
||||||
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Common;
|
|
||||||
using NzbDrone.Core.Download;
|
|
||||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
|
||||||
{
|
|
||||||
public class DownloadNzbFixture : CoreTest<Nzbget>
|
|
||||||
{
|
|
||||||
private const string _url = "http://www.nzbdrone.com";
|
|
||||||
private const string _title = "30.Rock.S01E01.Pilot.720p.hdtv";
|
|
||||||
private RemoteEpisode _remoteEpisode;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
_remoteEpisode = new RemoteEpisode();
|
|
||||||
_remoteEpisode.Release = new ReleaseInfo();
|
|
||||||
_remoteEpisode.Release.Title = _title;
|
|
||||||
_remoteEpisode.Release.DownloadUrl = _url;
|
|
||||||
|
|
||||||
_remoteEpisode.Episodes = Builder<Episode>.CreateListOfSize(1)
|
|
||||||
.All()
|
|
||||||
.With(e => e.AirDate = DateTime.Today.ToString(Episode.AIR_DATE_FORMAT))
|
|
||||||
.Build()
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
Subject.Definition = new DownloadClientDefinition();
|
|
||||||
Subject.Definition.Settings = new NzbgetSettings
|
|
||||||
{
|
|
||||||
Host = "localhost",
|
|
||||||
Port = 6789,
|
|
||||||
Username = "nzbget",
|
|
||||||
Password = "pass",
|
|
||||||
TvCategory = "tv",
|
|
||||||
RecentTvPriority = (int)NzbgetPriority.High
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_add_item_to_queue()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<INzbgetProxy>()
|
|
||||||
.Setup(s => s.DownloadNzb(It.IsAny<Stream>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<Int32>(), It.IsAny<NzbgetSettings>()))
|
|
||||||
.Returns("id");
|
|
||||||
|
|
||||||
Subject.DownloadNzb(_remoteEpisode);
|
|
||||||
|
|
||||||
Mocker.GetMock<INzbgetProxy>()
|
|
||||||
.Verify(v => v.DownloadNzb(It.IsAny<Stream>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<Int32>(), It.IsAny<NzbgetSettings>()), Times.Once());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,207 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using FizzWare.NBuilder;
|
||||||
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class NzbgetFixture : DownloadClientFixtureBase<Nzbget>
|
||||||
|
{
|
||||||
|
private NzbgetQueueItem _queued;
|
||||||
|
private NzbgetHistoryItem _failed;
|
||||||
|
private NzbgetHistoryItem _completed;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
Subject.Definition = new DownloadClientDefinition();
|
||||||
|
Subject.Definition.Settings = new NzbgetSettings
|
||||||
|
{
|
||||||
|
Host = "192.168.5.55",
|
||||||
|
Port = 2222,
|
||||||
|
Username = "admin",
|
||||||
|
Password = "pass",
|
||||||
|
TvCategory = "tv",
|
||||||
|
RecentTvPriority = (int)NzbgetPriority.High
|
||||||
|
};
|
||||||
|
|
||||||
|
_queued = new NzbgetQueueItem
|
||||||
|
{
|
||||||
|
FileSizeLo = 1000,
|
||||||
|
RemainingSizeLo = 10,
|
||||||
|
Category = "tv",
|
||||||
|
NzbName = "Droned.S01E01.Pilot.1080p.WEB-DL-DRONE",
|
||||||
|
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } }
|
||||||
|
};
|
||||||
|
|
||||||
|
_failed = new NzbgetHistoryItem
|
||||||
|
{
|
||||||
|
FileSizeLo = 1000,
|
||||||
|
Category = "tv",
|
||||||
|
Name = "Droned.S01E01.Pilot.1080p.WEB-DL-DRONE",
|
||||||
|
DestDir = "somedirectory",
|
||||||
|
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
|
||||||
|
ParStatus = "Some Error"
|
||||||
|
};
|
||||||
|
|
||||||
|
_completed = new NzbgetHistoryItem
|
||||||
|
{
|
||||||
|
FileSizeLo = 1000,
|
||||||
|
Category = "tv",
|
||||||
|
Name = "Droned.S01E01.Pilot.1080p.WEB-DL-DRONE",
|
||||||
|
DestDir = "somedirectory",
|
||||||
|
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
|
||||||
|
ParStatus = "SUCCESS",
|
||||||
|
ScriptStatus = "NONE"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WithFailedDownload()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<INzbgetProxy>()
|
||||||
|
.Setup(s => s.DownloadNzb(It.IsAny<Stream>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<int>(), It.IsAny<NzbgetSettings>()))
|
||||||
|
.Returns((String)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WithSuccessfulDownload()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<INzbgetProxy>()
|
||||||
|
.Setup(s => s.DownloadNzb(It.IsAny<Stream>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<int>(), It.IsAny<NzbgetSettings>()))
|
||||||
|
.Returns(Guid.NewGuid().ToString().Replace("-", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void WithQueue(NzbgetQueueItem queue)
|
||||||
|
{
|
||||||
|
var list = new List<NzbgetQueueItem>();
|
||||||
|
|
||||||
|
if (queue != null)
|
||||||
|
{
|
||||||
|
list.Add(queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
Mocker.GetMock<INzbgetProxy>()
|
||||||
|
.Setup(s => s.GetQueue(It.IsAny<NzbgetSettings>()))
|
||||||
|
.Returns(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void WithHistory(NzbgetHistoryItem history)
|
||||||
|
{
|
||||||
|
var list = new List<NzbgetHistoryItem>();
|
||||||
|
|
||||||
|
if (history != null)
|
||||||
|
{
|
||||||
|
list.Add(history);
|
||||||
|
}
|
||||||
|
|
||||||
|
Mocker.GetMock<INzbgetProxy>()
|
||||||
|
.Setup(s => s.GetHistory(It.IsAny<NzbgetSettings>()))
|
||||||
|
.Returns(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetItems_should_return_no_items_when_queue_is_empty()
|
||||||
|
{
|
||||||
|
WithQueue(null);
|
||||||
|
WithHistory(null);
|
||||||
|
|
||||||
|
Subject.GetItems().Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void queued_item_should_have_required_properties()
|
||||||
|
{
|
||||||
|
_queued.ActiveDownloads = 0;
|
||||||
|
|
||||||
|
WithQueue(_queued);
|
||||||
|
WithHistory(null);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
VerifyQueued(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void paused_item_should_have_required_properties()
|
||||||
|
{
|
||||||
|
_queued.PausedSizeLo = _queued.FileSizeLo;
|
||||||
|
|
||||||
|
WithQueue(_queued);
|
||||||
|
WithHistory(null);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
VerifyPaused(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void downloading_item_should_have_required_properties()
|
||||||
|
{
|
||||||
|
_queued.ActiveDownloads = 1;
|
||||||
|
|
||||||
|
WithQueue(_queued);
|
||||||
|
WithHistory(null);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
VerifyDownloading(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void completed_download_should_have_required_properties()
|
||||||
|
{
|
||||||
|
WithQueue(null);
|
||||||
|
WithHistory(_completed);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
VerifyCompleted(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void failed_item_should_have_required_properties()
|
||||||
|
{
|
||||||
|
WithQueue(null);
|
||||||
|
WithHistory(_failed);
|
||||||
|
|
||||||
|
var result = Subject.GetItems().Single();
|
||||||
|
|
||||||
|
VerifyFailed(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Download_should_return_unique_id()
|
||||||
|
{
|
||||||
|
WithSuccessfulDownload();
|
||||||
|
|
||||||
|
var remoteEpisode = CreateRemoteEpisode();
|
||||||
|
|
||||||
|
var id = Subject.Download(remoteEpisode);
|
||||||
|
|
||||||
|
id.Should().NotBeNullOrEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetItems_should_ignore_downloads_from_other_categories()
|
||||||
|
{
|
||||||
|
_completed.Category = "mycat";
|
||||||
|
|
||||||
|
WithQueue(null);
|
||||||
|
WithHistory(_completed);
|
||||||
|
|
||||||
|
var items = Subject.GetItems();
|
||||||
|
|
||||||
|
items.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,84 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.Download;
|
|
||||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
|
||||||
using NzbDrone.Core.Parser;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
|
||||||
{
|
|
||||||
public class QueueFixture : CoreTest<Nzbget>
|
|
||||||
{
|
|
||||||
private List<NzbgetQueueItem> _queue;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
_queue = Builder<NzbgetQueueItem>.CreateListOfSize(5)
|
|
||||||
.All()
|
|
||||||
.With(q => q.NzbName = "30.Rock.S01E01.Pilot.720p.hdtv.nzb")
|
|
||||||
.With(q => q.Parameters = new List<NzbgetParameter>
|
|
||||||
{
|
|
||||||
new NzbgetParameter { Name = "drone", Value = "id" }
|
|
||||||
})
|
|
||||||
.Build()
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
Subject.Definition = new DownloadClientDefinition();
|
|
||||||
Subject.Definition.Settings = new NzbgetSettings
|
|
||||||
{
|
|
||||||
Host = "localhost",
|
|
||||||
Port = 6789,
|
|
||||||
Username = "nzbget",
|
|
||||||
Password = "pass",
|
|
||||||
TvCategory = "tv",
|
|
||||||
RecentTvPriority = (int)NzbgetPriority.High
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithFullQueue()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<INzbgetProxy>()
|
|
||||||
.Setup(s => s.GetQueue(It.IsAny<NzbgetSettings>()))
|
|
||||||
.Returns(_queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithEmptyQueue()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<INzbgetProxy>()
|
|
||||||
.Setup(s => s.GetQueue(It.IsAny<NzbgetSettings>()))
|
|
||||||
.Returns(new List<NzbgetQueueItem>());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_no_items_when_queue_is_empty()
|
|
||||||
{
|
|
||||||
WithEmptyQueue();
|
|
||||||
|
|
||||||
Subject.GetQueue()
|
|
||||||
.Should()
|
|
||||||
.BeEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_item_when_queue_has_item()
|
|
||||||
{
|
|
||||||
WithFullQueue();
|
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
|
||||||
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), 0, null))
|
|
||||||
.Returns(new RemoteEpisode {Series = new Series()});
|
|
||||||
|
|
||||||
Subject.GetQueue()
|
|
||||||
.Should()
|
|
||||||
.HaveCount(_queue.Count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration />
|
@ -1,8 +0,0 @@
|
|||||||
namespace NzbDrone.Core.Indexers
|
|
||||||
{
|
|
||||||
public enum DownloadProtocols
|
|
||||||
{
|
|
||||||
Nzb = 0,
|
|
||||||
Torrent =1
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.ThingiProvider;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Eztv
|
|
||||||
{
|
|
||||||
public class Eztv : IndexerBase<NullConfig>
|
|
||||||
{
|
|
||||||
public override DownloadProtocol Protocol
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DownloadProtocol.Torrent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool SupportsPaging
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IParseFeed Parser
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new BasicTorrentRssParser();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<string> RecentFeed
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
yield return "http://www.ezrss.it/feed/";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber)
|
|
||||||
{
|
|
||||||
yield return string.Format("http://www.ezrss.it/search/index.php?show_name={0}&season={1}&episode={2}&mode=rss", seriesTitle, seasonNumber, episodeNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int offset)
|
|
||||||
{
|
|
||||||
yield return string.Format("http://www.ezrss.it/search/index.php?show_name={0}&season={1}&mode=rss", seriesTitle, seasonNumber);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date)
|
|
||||||
{
|
|
||||||
//EZTV doesn't support searching based on actual episode airdate. they only support release date.
|
|
||||||
return new string[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<string> GetSearchUrls(string query, int offset)
|
|
||||||
{
|
|
||||||
return new List<string>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue