From c9d0bc714825adf0fdb94a51d345cd1763e8a961 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 28 Jun 2015 17:42:31 +0200 Subject: [PATCH] Fixed: Removed Eztv-like api support entirely since TorrentRss is now available. --- .../{Eztv/Eztv.xml => TorrentRss/Ezrss.xml} | 0 .../IndexerTests/EztvTests/EztvFixture.cs | 57 -------------- .../IndexerIntegrationTests.cs | 19 ----- .../TorrentRssIndexerFixture.cs | 4 +- .../TorrentRssSettingsDetectorFixture.cs | 4 +- .../NzbDrone.Core.Test.csproj | 3 +- .../Datastore/Migration/087_remove_eztv.cs | 14 ++++ src/NzbDrone.Core/Indexers/Eztv/Eztv.cs | 36 --------- .../Indexers/Eztv/EztvRequestGenerator.cs | 77 ------------------- .../Indexers/Eztv/EztvSettings.cs | 34 -------- src/NzbDrone.Core/NzbDrone.Core.csproj | 4 +- 11 files changed, 20 insertions(+), 232 deletions(-) rename src/NzbDrone.Core.Test/Files/Indexers/{Eztv/Eztv.xml => TorrentRss/Ezrss.xml} (100%) delete mode 100644 src/NzbDrone.Core.Test/IndexerTests/EztvTests/EztvFixture.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/087_remove_eztv.cs delete mode 100644 src/NzbDrone.Core/Indexers/Eztv/Eztv.cs delete mode 100644 src/NzbDrone.Core/Indexers/Eztv/EztvRequestGenerator.cs delete mode 100644 src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs diff --git a/src/NzbDrone.Core.Test/Files/Indexers/Eztv/Eztv.xml b/src/NzbDrone.Core.Test/Files/Indexers/TorrentRss/Ezrss.xml similarity index 100% rename from src/NzbDrone.Core.Test/Files/Indexers/Eztv/Eztv.xml rename to src/NzbDrone.Core.Test/Files/Indexers/TorrentRss/Ezrss.xml diff --git a/src/NzbDrone.Core.Test/IndexerTests/EztvTests/EztvFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/EztvTests/EztvFixture.cs deleted file mode 100644 index c3cd654aa..000000000 --- a/src/NzbDrone.Core.Test/IndexerTests/EztvTests/EztvFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Moq; -using NUnit.Framework; -using NzbDrone.Common.Http; -using NzbDrone.Core.Indexers; -using NzbDrone.Core.Indexers.Eztv; -using NzbDrone.Core.Parser.Model; -using NzbDrone.Core.Test.Framework; -using System; -using System.Linq; -using FluentAssertions; - -namespace NzbDrone.Core.Test.IndexerTests.EztvTests -{ - [TestFixture] - public class EztvFixture : CoreTest - { - [SetUp] - public void Setup() - { - Subject.Definition = new IndexerDefinition() - { - Name = "Eztv", - Settings = new EztvSettings { BaseUrl = "https://www.ezrss.it/" } - }; - } - - [Test] - public void should_parse_recent_feed_from_Eztv() - { - var recentFeed = ReadAllText(@"Files/Indexers/Eztv/Eztv.xml"); - - Mocker.GetMock() - .Setup(o => o.Execute(It.Is(v => v.Method == HttpMethod.GET))) - .Returns(r => new HttpResponse(r, new HttpHeader(), recentFeed)); - - var releases = Subject.FetchRecent(); - - releases.Should().HaveCount(3); - releases.First().Should().BeOfType(); - - var torrentInfo = releases.First() as TorrentInfo; - - torrentInfo.Title.Should().Be("S4C I Grombil Cyfandir Pell American Interior [PDTV - MVGROUP]"); - torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); - torrentInfo.DownloadUrl.Should().Be("http://re.zoink.it/20a4ed4eFC"); - torrentInfo.InfoUrl.Should().Be("http://eztv.it/ep/58439/s4c-i-grombil-cyfandir-pell-american-interior-pdtv-x264-mvgroup/"); - torrentInfo.CommentUrl.Should().Be("http://eztv.it/forum/discuss/58439/"); - torrentInfo.Indexer.Should().Be(Subject.Definition.Name); - torrentInfo.PublishDate.Should().Be(DateTime.Parse("2014/09/15 18:39:00")); - torrentInfo.Size.Should().Be(796606175); - torrentInfo.InfoHash.Should().Be("20FC4FBFA88272274AC671F857CC15144E9AA83E"); - torrentInfo.MagnetUrl.Should().Be("magnet:?xt=urn:btih:ED6E7P5IQJZCOSWGOH4FPTAVCRHJVKB6&dn=S4C.I.Grombil.Cyfandir.Pell.American.Interior.PDTV.x264-MVGroup"); - torrentInfo.Peers.Should().NotHaveValue(); - torrentInfo.Seeders.Should().NotHaveValue(); - } - } -} diff --git a/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs b/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs index dbb6d0f8d..8284b8ca3 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs @@ -4,7 +4,6 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; -using NzbDrone.Core.Indexers.Eztv; using NzbDrone.Core.Indexers.Fanzub; using NzbDrone.Core.Indexers.KickassTorrents; using NzbDrone.Core.Indexers.Nyaa; @@ -126,24 +125,6 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests ValidateTorrentResult(result, hasSize: true, hasMagnet: true); } - [Test] - public void eztv_fetch_recent() - { - Assert.Inconclusive("Eztv Down"); - - var indexer = Mocker.Resolve(); - - indexer.Definition = new IndexerDefinition - { - Name = "MyIndexer", - Settings = new EztvSettings() - }; - - var result = indexer.FetchRecent(); - - ValidateTorrentResult(result, hasSize: true, hasMagnet: true); - } - [Test] public void nyaa_fetch_recent() { diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs index e56f2c8f7..097ac2ec4 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs @@ -71,9 +71,9 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests } [Test] - public void should_parse_recent_feed_from_Eztv() + public void should_parse_recent_feed_from_Ezrss() { - GivenRecentFeedResponse("Eztv/Eztv.xml"); + GivenRecentFeedResponse("TorrentRss/Ezrss.xml"); var releases = Subject.FetchRecent(); diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs index 220ec249f..0a9f77ba0 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs @@ -34,9 +34,9 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests } [Test] - public void should_detect_rss_settings_for_eztv() + public void should_detect_rss_settings_for_ezrss() { - GivenRecentFeedResponse("Eztv/Eztv.xml"); + GivenRecentFeedResponse("TorrentRss/Ezrss.xml"); var settings = Subject.Detect(_indexerSettings); diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 09606e07f..1b560448f 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -209,7 +209,6 @@ - @@ -406,7 +405,7 @@ Always - + Always Designer diff --git a/src/NzbDrone.Core/Datastore/Migration/087_remove_eztv.cs b/src/NzbDrone.Core/Datastore/Migration/087_remove_eztv.cs new file mode 100644 index 000000000..d6990053a --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/087_remove_eztv.cs @@ -0,0 +1,14 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(87)] + public class remove_eztv : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Execute.Sql("DELETE FROM Indexers WHERE Implementation = 'Eztv'"); + } + } +} diff --git a/src/NzbDrone.Core/Indexers/Eztv/Eztv.cs b/src/NzbDrone.Core/Indexers/Eztv/Eztv.cs deleted file mode 100644 index efb41b385..000000000 --- a/src/NzbDrone.Core/Indexers/Eztv/Eztv.cs +++ /dev/null @@ -1,36 +0,0 @@ -using NzbDrone.Common.Http; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Parser; -using NLog; - -namespace NzbDrone.Core.Indexers.Eztv -{ - public class Eztv : HttpIndexerBase - { - public override string Name - { - get - { - return "EZTV"; - } - } - - public override DownloadProtocol Protocol { get { return DownloadProtocol.Torrent; } } - - public Eztv(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger) - : base(httpClient, configService, parsingService, logger) - { - - } - - public override IIndexerRequestGenerator GetRequestGenerator() - { - return new EztvRequestGenerator() { Settings = Settings }; - } - - public override IParseIndexerResponse GetParser() - { - return new EzrssTorrentRssParser(); - } - } -} \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Eztv/EztvRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Eztv/EztvRequestGenerator.cs deleted file mode 100644 index a25eeeeaa..000000000 --- a/src/NzbDrone.Core/Indexers/Eztv/EztvRequestGenerator.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using NzbDrone.Common.Extensions; -using NzbDrone.Common.Http; -using NzbDrone.Core.IndexerSearch.Definitions; - -namespace NzbDrone.Core.Indexers.Eztv -{ - public class EztvRequestGenerator : IIndexerRequestGenerator - { - public EztvSettings Settings { get; set; } - - public EztvRequestGenerator() - { - - } - - public virtual IList> GetRecentRequests() - { - var pageableRequests = new List>(); - - pageableRequests.AddIfNotNull(GetPagedRequests("/feed/")); - - return pageableRequests; - } - - public virtual IList> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) - { - var pageableRequests = new List>(); - - foreach (var queryTitle in searchCriteria.QueryTitles) - { - pageableRequests.AddIfNotNull(GetPagedRequests(String.Format("/search/index.php?show_name={0}&season={1}&episode={2}&mode=rss", - queryTitle, - searchCriteria.SeasonNumber, - searchCriteria.EpisodeNumber))); - } - - return pageableRequests; - } - - public virtual IList> GetSearchRequests(SeasonSearchCriteria searchCriteria) - { - var pageableRequests = new List>(); - - foreach (var queryTitle in searchCriteria.QueryTitles) - { - pageableRequests.AddIfNotNull(GetPagedRequests(String.Format("/search/index.php?show_name={0}&season={1}&mode=rss", - queryTitle, - searchCriteria.SeasonNumber))); - } - - return pageableRequests; - } - - public virtual IList> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) - { - //EZTV doesn't support searching based on actual episode airdate. they only support release date. - return new List>(); - } - - public virtual IList> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) - { - return new List>(); - } - - public virtual IList> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) - { - return new List>(); - } - - private IEnumerable GetPagedRequests(String query) - { - yield return new IndexerRequest(Settings.BaseUrl.TrimEnd('/') + query, HttpAccept.Rss); - } - } -} diff --git a/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs b/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs deleted file mode 100644 index 795e66f32..000000000 --- a/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using FluentValidation; -using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; -using NzbDrone.Core.Validation; - -namespace NzbDrone.Core.Indexers.Eztv -{ - public class EztvSettingsValidator : AbstractValidator - { - public EztvSettingsValidator() - { - RuleFor(c => c.BaseUrl).ValidRootUrl(); - } - } - - public class EztvSettings : IProviderConfig - { - private static readonly EztvSettingsValidator Validator = new EztvSettingsValidator(); - - public EztvSettings() - { - BaseUrl = ""; - } - - [FieldDefinition(0, Label = "Website URL", HelpText = "Enter to URL to an EZTV compatible RSS feed")] - public String BaseUrl { get; set; } - - public NzbDroneValidationResult Validate() - { - return new NzbDroneValidationResult(Validator.Validate(this)); - } - } -} \ No newline at end of file diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 71a23ba27..d2aafd02f 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -241,6 +241,7 @@ + @@ -473,9 +474,6 @@ - - -