From 1d339ad4f1d052bce556ed29d2a4164792072d75 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 22 Feb 2020 01:23:41 +0100 Subject: [PATCH] Belated removal of bitmetv and cleanup of usenet-crawler. --- .../CleanseLogMessageFixture.cs | 1 - .../Files/Indexers/BitMeTv/BitMeTv.xml | 65 ------------------- .../BitMeTvTests/BitMeTvFixture.cs | 57 ---------------- .../TorrentRssSettingsDetectorFixture.cs | 1 - .../Datastore/Migration/138_remove_bitmetv.cs | 17 +++++ src/NzbDrone.Core/Indexers/BitMeTv/BitMeTv.cs | 32 --------- .../BitMeTv/BitMeTvRequestGenerator.cs | 62 ------------------ .../Indexers/BitMeTv/BitMeTvSettings.cs | 60 ----------------- src/NzbDrone.Core/Indexers/Newznab/Newznab.cs | 1 - .../Profiles/Release/ReleaseProfileModule.cs | 1 + 10 files changed, 18 insertions(+), 279 deletions(-) delete mode 100644 src/NzbDrone.Core.Test/Files/Indexers/BitMeTv/BitMeTv.xml delete mode 100644 src/NzbDrone.Core.Test/IndexerTests/BitMeTvTests/BitMeTvFixture.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/138_remove_bitmetv.cs delete mode 100644 src/NzbDrone.Core/Indexers/BitMeTv/BitMeTv.cs delete mode 100644 src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvRequestGenerator.cs delete mode 100644 src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs diff --git a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs index 0dcee3165..60f7b0c86 100644 --- a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs +++ b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs @@ -11,7 +11,6 @@ namespace NzbDrone.Common.Test.InstrumentationTests [TestCase(@"https://iptorrents.com/torrents/rss?u=mySecret;tp=mySecret;l5;download")] [TestCase(@"http://rss.torrentleech.org/mySecret")] [TestCase(@"http://rss.torrentleech.org/rss/download/12345/01233210/filename.torrent")] - [TestCase(@"http://www.bitmetv.org/rss.php?uid=mySecret&passkey=mySecret")] [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")] diff --git a/src/NzbDrone.Core.Test/Files/Indexers/BitMeTv/BitMeTv.xml b/src/NzbDrone.Core.Test/Files/Indexers/BitMeTv/BitMeTv.xml deleted file mode 100644 index 345c51c87..000000000 --- a/src/NzbDrone.Core.Test/Files/Indexers/BitMeTv/BitMeTv.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 10 - BitMeTV.ORG - http://www.bitmetv.org - This is a private - by registration only - website. You can help keep it alive by donating: http://www.bitmetv.org/donate.php - en-usde - Copyright © 2004 - 2007 BitMeTV.ORG - noreply@bitmetv.org - - BitMeTV.ORG - http://www.bitmetv.org/favicon.ico - http://www.bitmetv.org - 16 - 16 - This is a private - by registration only - website. You can help keep it alive by donating: http://www.bitmetv.org/donate.php - - - Total.Divas.S02E08.HDTV.x264-CRiMSON - http://www.bitmetv.org/download.php/12/Total.Divas.S02E08.HDTV.x264-CRiMSON.torrent - Tue, 13 May 2014 17:04:29 -0000 - - Category: (Reality TV - Un-scripted) - Size: 376.71 MB - - - - Aqua.Teen.Hunger.Force.S10.INTERNAL.HDTV.x264-BitMeTV - http://www.bitmetv.org/download.php/34/Aqua.Teen.Hunger.Force.S10.INTERNAL.HDTV.x264-BitMeTV.torrent - Tue, 13 May 2014 17:03:12 -0000 - - Category: (Adult Swim) - Size: 725.46 MB - - - - Antiques.Roadshow.US.S18E16.720p.HDTV.x264-BAJSKORV - http://www.bitmetv.org/download.php/56/Antiques.Roadshow.US.S18E16.720p.HDTV.x264-BAJSKORV.torrent - Tue, 13 May 2014 16:47:05 -0000 - - Category: (Reality TV - Un-scripted) - Size: 960.15 MB - - - - Seth.Meyers.2014.05.12.Chris.O.Dowd-Emma.Roberts.HDTV.x264-CROOKS - http://www.bitmetv.org/download.php/78/Seth.Meyers.2014.05.12.Chris.O.Dowd-Emma.Roberts.HDTV.x264-CROOKS.torrent - Tue, 13 May 2014 16:01:21 -0000 - - Category: Seth Meyers - Size: 301.31 MB - - - - The.Mole.Australia.Season.4 - http://www.bitmetv.org/download.php/910/The%20Mole%20Australia%20-%20Season%204.torrent - Tue, 13 May 2014 15:52:54 -0000 - - Category: (Reality TV - Competitive) - Size: 2.13 GB - - - - diff --git a/src/NzbDrone.Core.Test/IndexerTests/BitMeTvTests/BitMeTvFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/BitMeTvTests/BitMeTvFixture.cs deleted file mode 100644 index d49d940a4..000000000 --- a/src/NzbDrone.Core.Test/IndexerTests/BitMeTvTests/BitMeTvFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Moq; -using NUnit.Framework; -using NzbDrone.Common.Http; -using NzbDrone.Core.Indexers; -using NzbDrone.Core.Indexers.BitMeTv; -using NzbDrone.Core.Parser.Model; -using NzbDrone.Core.Test.Framework; -using System; -using System.Linq; -using FluentAssertions; - -namespace NzbDrone.Core.Test.IndexerTests.BitMeTvTests -{ - [TestFixture] - public class BitMeTvFixture : CoreTest - { - [SetUp] - public void Setup() - { - Subject.Definition = new IndexerDefinition() - { - Name = "BitMeTV", - Settings = new BitMeTvSettings() { Cookie = "uid=123" } - }; - } - - [Test] - public void should_parse_recent_feed_from_BitMeTv() - { - var recentFeed = ReadAllText(@"Files/Indexers/BitMeTv/BitMeTv.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(5); - releases.First().Should().BeOfType(); - - var torrentInfo = releases.First() as TorrentInfo; - - torrentInfo.Title.Should().Be("Total.Divas.S02E08.HDTV.x264-CRiMSON"); - torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); - torrentInfo.DownloadUrl.Should().Be("http://www.bitmetv.org/download.php/12/Total.Divas.S02E08.HDTV.x264-CRiMSON.torrent"); - torrentInfo.InfoUrl.Should().BeNullOrEmpty(); - torrentInfo.CommentUrl.Should().BeNullOrEmpty(); - torrentInfo.Indexer.Should().Be(Subject.Definition.Name); - torrentInfo.PublishDate.Should().Be(DateTime.Parse("2014/05/13 17:04:29")); - torrentInfo.Size.Should().Be(395009065); - torrentInfo.InfoHash.Should().Be(null); - torrentInfo.MagnetUrl.Should().Be(null); - torrentInfo.Peers.Should().Be(null); - torrentInfo.Seeders.Should().Be(null); - } - } -} diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs index 2f34f1d00..482c95334 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssSettingsDetectorFixture.cs @@ -253,7 +253,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")] diff --git a/src/NzbDrone.Core/Datastore/Migration/138_remove_bitmetv.cs b/src/NzbDrone.Core/Datastore/Migration/138_remove_bitmetv.cs new file mode 100644 index 000000000..455084c8b --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/138_remove_bitmetv.cs @@ -0,0 +1,17 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(138)] + public class remove_bitmetv : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Execute.Sql("DELETE FROM Indexers WHERE Implementation = 'BitMeTv'"); + + // Also disable usenet-crawler for the poor guys that still have it enabled + Execute.Sql("UPDATE Indexers SET EnableRss = 0, EnableAutomaticSearch = 0, EnableInteractiveSearch = 0 WHERE Implementation = 'Newznab' AND Settings LIKE '%usenet-crawler.com%'"); + } + } +} diff --git a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTv.cs b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTv.cs deleted file mode 100644 index d6bfec2fb..000000000 --- a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTv.cs +++ /dev/null @@ -1,32 +0,0 @@ -using NzbDrone.Common.Http; -using NzbDrone.Core.Configuration; -using NLog; -using NzbDrone.Core.Parser; - -namespace NzbDrone.Core.Indexers.BitMeTv -{ - public class BitMeTv : HttpIndexerBase - { - public override string Name => "BitMeTV"; - - public override DownloadProtocol Protocol => DownloadProtocol.Torrent; - public override bool SupportsSearch => false; - public override int PageSize => 0; - - public BitMeTv(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger) - : base(httpClient, indexerStatusService, configService, parsingService, logger) - { - - } - - public override IIndexerRequestGenerator GetRequestGenerator() - { - return new BitMeTvRequestGenerator() { Settings = Settings }; - } - - public override IParseIndexerResponse GetParser() - { - return new TorrentRssParser() { ParseSizeInDescription = true }; - } - } -} \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvRequestGenerator.cs b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvRequestGenerator.cs deleted file mode 100644 index efa19c679..000000000 --- a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvRequestGenerator.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Collections.Generic; -using NzbDrone.Common.Http; -using NzbDrone.Core.IndexerSearch.Definitions; - -namespace NzbDrone.Core.Indexers.BitMeTv -{ - public class BitMeTvRequestGenerator : IIndexerRequestGenerator - { - public BitMeTvSettings Settings { get; set; } - - public virtual IndexerPageableRequestChain GetRecentRequests() - { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetRssRequests()); - - return pageableRequests; - } - - public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(DailySeasonSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) - { - return new IndexerPageableRequestChain(); - } - - private IEnumerable GetRssRequests() - { - var request = new IndexerRequest(string.Format("{0}/rss.php?uid={1}&passkey={2}", Settings.BaseUrl.Trim().TrimEnd('/'), Settings.UserId, Settings.RssPasskey), HttpAccept.Html); - - foreach (var cookie in HttpHeader.ParseCookies(Settings.Cookie)) - { - request.HttpRequest.Cookies[cookie.Key] = cookie.Value; - } - - yield return request; - } - } -} diff --git a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs deleted file mode 100644 index 27126dda9..000000000 --- a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.Text.RegularExpressions; -using FluentValidation; -using NzbDrone.Core.Annotations; -using NzbDrone.Core.Validation; - -namespace NzbDrone.Core.Indexers.BitMeTv -{ - public class BitMeTvSettingsValidator : AbstractValidator - { - public BitMeTvSettingsValidator() - { - RuleFor(c => c.BaseUrl).ValidRootUrl(); - RuleFor(c => c.UserId).NotEmpty(); - RuleFor(c => c.RssPasskey).NotEmpty(); - - RuleFor(c => c.Cookie).NotEmpty(); - - RuleFor(c => c.Cookie) - .Matches(@"pass=[0-9a-f]{32}", RegexOptions.IgnoreCase) - .WithMessage("Wrong pattern") - .AsWarning(); - - RuleFor(c => c.SeedCriteria).SetValidator(_ => new SeedCriteriaSettingsValidator()); - } - } - - public class BitMeTvSettings : ITorrentIndexerSettings - { - private static readonly BitMeTvSettingsValidator Validator = new BitMeTvSettingsValidator(); - - public BitMeTvSettings() - { - BaseUrl = "https://www.bitmetv.org"; - MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS; - } - - [FieldDefinition(0, Label = "Website URL")] - public string BaseUrl { get; set; } - - [FieldDefinition(1, Label = "UserId")] - public string UserId { get; set; } - - [FieldDefinition(2, Label = "RSS Passkey")] - public string RssPasskey { get; set; } - - [FieldDefinition(3, Label = "Cookie", HelpText = "BitMeTv uses a login cookie needed to access the rss, you'll have to retrieve it via a browser.")] - public string Cookie { get; set; } - - [FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)] - public int MinimumSeeders { get; set; } - - [FieldDefinition(5)] - public SeedCriteriaSettings SeedCriteria { get; } = new SeedCriteriaSettings(); - - public NzbDroneValidationResult Validate() - { - return new NzbDroneValidationResult(Validator.Validate(this)); - } - } -} diff --git a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs index 2a3dabe86..b8d51df32 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -51,7 +51,6 @@ namespace NzbDrone.Core.Indexers.Newznab yield return GetDefinition("OZnzb.com", GetSettings("https://api.oznzb.com")); yield return GetDefinition("SimplyNZBs", GetSettings("https://simplynzbs.com")); yield return GetDefinition("Tabula Rasa", GetSettings("https://www.tabula-rasa.pw", apiPath: @"/api/v1/api")); - yield return GetDefinition("Usenet Crawler", GetSettings("https://www.usenet-crawler.com")); yield return GetDefinition("AnimeTosho Usenet", GetSettings("https://feed.animetosho.org", apiPath: @"/nabapi", categories: new int[0], animeCategories: new[] { 5070 })); } } diff --git a/src/Sonarr.Api.V3/Profiles/Release/ReleaseProfileModule.cs b/src/Sonarr.Api.V3/Profiles/Release/ReleaseProfileModule.cs index 1d6c75ab0..a01f4115e 100644 --- a/src/Sonarr.Api.V3/Profiles/Release/ReleaseProfileModule.cs +++ b/src/Sonarr.Api.V3/Profiles/Release/ReleaseProfileModule.cs @@ -36,6 +36,7 @@ namespace Sonarr.Api.V3.Profiles.Release { context.AddFailure(nameof(ReleaseProfile.IndexerId), "Indexer does not exist"); } + context.AddFailure(nameof(ReleaseProfile.Preferred), "Indexer does not exist"); }); }