1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-27 22:57:09 -04:00

New: Filelist.ro Indexer

Fixes #4061
This commit is contained in:
Qstick
2020-01-25 17:49:40 -05:00
parent 3d17498945
commit 1c8f94f1d8
14 changed files with 480 additions and 392 deletions
@@ -0,0 +1,57 @@
using System;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.FileList;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.IndexerTests.FileListTests
{
[TestFixture]
public class FileListFixture : CoreTest<FileList>
{
[SetUp]
public void Setup()
{
Subject.Definition = new IndexerDefinition()
{
Name = "FileList",
Settings = new FileListSettings() { Username = "someuser", Passkey = "somepass" }
};
}
[Test]
public void should_parse_recent_feed_from_FileList()
{
var recentFeed = ReadAllText(@"Files/Indexers/FileList/recentfeed.json");
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
var releases = Subject.FetchRecent();
releases.Should().HaveCount(4);
releases.First().Should().BeOfType<TorrentInfo>();
var torrentInfo = releases.First() as TorrentInfo;
torrentInfo.Title.Should().Be("Storming.Juno.2010.1080p.BluRay.x264-GUACAMOLE");
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
torrentInfo.DownloadUrl.Should().Be("https://filelist.ro/download.php?id=665873&passkey=somepass");
torrentInfo.InfoUrl.Should().Be("https://filelist.ro/details.php?id=665873");
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2020-01-25 22:20:19"));
torrentInfo.Size.Should().Be(8300512414);
torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(2 + 12);
torrentInfo.Seeders.Should().Be(12);
}
}
}
@@ -0,0 +1,78 @@
using System.Linq;
using FluentAssertions;
using Newtonsoft.Json;
using NUnit.Framework;
using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers.FileList;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.IndexerTests.FileListTests
{
public class FileListRequestGeneratorFixture : CoreTest<FileListRequestGenerator>
{
private MovieSearchCriteria _movieSearchCriteria;
[SetUp]
public void Setup()
{
Subject.Settings = new FileListSettings()
{
BaseUrl = "http://127.0.0.1:1234/",
Categories = new[] { 1, 2 },
Passkey = "abcd",
Username = "somename"
};
_movieSearchCriteria = new MovieSearchCriteria
{
Movie = new Movies.Movie { ImdbId = "tt0076759", Title = "Star Wars", Year = 1977 }
};
}
private void MovieWithoutIMDB()
{
_movieSearchCriteria.Movie.ImdbId = null;
}
[Test]
public void should_use_categories_for_feed()
{
var results = Subject.GetRecentRequests();
results.GetAllTiers().Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("&category=1,2&");
}
[Test]
public void should_not_search_by_imdbid_if_not_supported()
{
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("type=imdb");
page.Url.Query.Should().Contain("query=tt0076759");
}
[Test]
public void should_search_by_name_and_year_if_missing_imdbid()
{
MovieWithoutIMDB();
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("type=name");
page.Url.Query.Should().Contain("query=Star Wars 1977");
}
}
}
@@ -1,4 +1,4 @@
using FluentAssertions;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
@@ -252,7 +252,6 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
});
}
[TestCase("BitMeTv/BitMeTv.xml")]
[TestCase("IPTorrents/IPTorrents.xml")]
[TestCase("Nyaa/Nyaa.xml")]
[TestCase("Torznab/torznab_hdaccess_net.xml")]