From be6f89cd7665d69b68a54eed3d78e3ef0d398b20 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 29 Oct 2017 17:07:55 -0400 Subject: [PATCH] Fixed: Size parsing of empty description from torrent RSS feeds --- .../Indexers/TorrentRss/EvolutionWorld.xml | 30 +++++++++++++++++++ .../IndexerTests/BasicRssParserFixture.cs | 5 ++-- .../TorrentRssIndexerFixture.cs | 29 +++++++++++++++++- .../NzbDrone.Core.Test.csproj | 4 +++ src/NzbDrone.Core/Indexers/RssParser.cs | 5 ++++ 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 src/NzbDrone.Core.Test/Files/Indexers/TorrentRss/EvolutionWorld.xml diff --git a/src/NzbDrone.Core.Test/Files/Indexers/TorrentRss/EvolutionWorld.xml b/src/NzbDrone.Core.Test/Files/Indexers/TorrentRss/EvolutionWorld.xml new file mode 100644 index 000000000..48c5b651b --- /dev/null +++ b/src/NzbDrone.Core.Test/Files/Indexers/TorrentRss/EvolutionWorld.xml @@ -0,0 +1,30 @@ + + + + Evolution World + Advanced RSS Feed for xbtitFM by Petr1fied + http://ew.pw + Tue, 15 Aug 2017 00:00:00 +0000 + (c) 2017 Evolution World + + + + <![CDATA[[TVShow --> TVShow Bluray 720p] Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER [SEEDERS (3)/LEECHERS (0)]]]> + Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER



Plot:

Various chronicles of deception, intrigue and murder in and around frozen Minnesota.

Note::-
Encode is tested and its perfect, no sync issue there in any episode.
All episodes comes with AC3 Audio for better audio and video plaback and English Subs are muxed in video .

TECHNiCAL Information:


RUNTIME..................: 1 hr x 10
Total SIZE...............: 9.75 GiB
Total Episodes...........: 10
VIDEO CODEC..............: x264 2nd Pass (High,L4.1)
RESOLUTION...............: 1280x720
BITRATE (Video)..........: 2100 Kbps - 2400 kbps
Aspect Ratio.............: 16:9
Video Container..........: MKV
FRAMERATE................: 23.967 fps
AUDIO....................: English AC3 6 Channel 384 kbps
SUBTITLES................: English, English (SDH)
CHAPTERS.................: Yes
SOURCE...................: DON (Thanks !)


GENRE...................: Crime | Drama | Thriller
RATING..................: 9.1/10 from 140,765 users
IMDB link...............: http://www.imdb.com/title/tt2802850/]]>
+ http://ew.pw/index.php?page=torrent-details&id=dea071a7a62a0d662538d46402fb112f30b8c9fa + http://ew.pw/index.php?page=torrent-details&id=dea071a7a62a0d662538d46402fb112f30b8c9fa + + Sun, 13 Aug 2017 22:21:43 +0000 +
+ + + <![CDATA[[TVShow --> TVShow Bluray 720p] American Horror Story S04 Complete Season 4 720p BRRip DD5.1 x264 - PSYPHER [SEEDERS (2)/LEECHERS (0)]]]> + + http://ew.pw/index.php?page=torrent-details&id=2725fe19ea2addf5aafbd523d134191b8abbb2ee + http://ew.pw/index.php?page=torrent-details&id=2725fe19ea2addf5aafbd523d134191b8abbb2ee + + Fri, 28 Jul 2017 16:29:51 +0000 + +
+
+ \ No newline at end of file diff --git a/src/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs index b2819434d..d75079fbd 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Text; using FluentAssertions; using NUnit.Framework; @@ -30,6 +30,7 @@ namespace NzbDrone.Core.Test.IndexerTests [TestCase("100 Kb/s")] [TestCase(" 12341234")] [TestCase("12341234 other")] + [TestCase("")] public void should_not_parse_size(string sizeString) { var result = RssParser.ParseSize(sizeString, true); @@ -58,4 +59,4 @@ namespace NzbDrone.Core.Test.IndexerTests result.First().DownloadUrl.Should().Be("http://my.indexer.com/getnzb/123.nzb&i=782&r=123"); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs index 23d653e5a..169d40888 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorrentRssIndexerTests/TorrentRssIndexerFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using FluentAssertions; using Moq; @@ -262,6 +262,33 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests } [Test] + public void should_parse_recent_feed_from_EveolutionWorld_without_size() + { + Subject.Definition.Settings.As().AllowZeroSize = true; + GivenRecentFeedResponse("TorrentRss/EvolutionWorld.xml"); + + var releases = Subject.FetchRecent(); + + releases.Should().HaveCount(2); + releases.First().Should().BeOfType(); + + var torrentInfo = releases.First() as TorrentInfo; + + torrentInfo.Title.Should().Be("[TVShow --> TVShow Bluray 720p] Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER [SEEDERS (3)/LEECHERS (0)]"); + torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); + torrentInfo.DownloadUrl.Should().Be("http://ew.pw/download.php?id=dea071a7a62a0d662538d46402fb112f30b8c9fa&f=Fargo%20S01%20Complete%20Season%201%20720p%20BRRip%20DD5.1%20x264-PSYPHER.torrent&auth=secret"); + torrentInfo.InfoUrl.Should().BeNullOrEmpty(); + torrentInfo.CommentUrl.Should().BeNullOrEmpty(); + torrentInfo.Indexer.Should().Be(Subject.Definition.Name); + torrentInfo.PublishDate.Should().Be(DateTime.Parse("2017-08-13T22:21:43Z").ToUniversalTime()); + torrentInfo.Size.Should().Be(0); + torrentInfo.InfoHash.Should().BeNull(); + torrentInfo.MagnetUrl.Should().BeNull(); + torrentInfo.Peers.Should().NotHaveValue(); + torrentInfo.Seeders.Should().NotHaveValue(); + } + + [Test] public void should_record_indexer_failure_if_unsupported_feed() { GivenRecentFeedResponse("TorrentRss/invalid/TorrentDay_NoPubDate.xml"); diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index f820b351f..a887a3346 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -370,6 +370,10 @@ sqlite3.dll Always + + Designer + Always + Always Designer diff --git a/src/NzbDrone.Core/Indexers/RssParser.cs b/src/NzbDrone.Core/Indexers/RssParser.cs index 4cab5b6c7..a77563236 100644 --- a/src/NzbDrone.Core/Indexers/RssParser.cs +++ b/src/NzbDrone.Core/Indexers/RssParser.cs @@ -344,6 +344,11 @@ namespace NzbDrone.Core.Indexers public static long ParseSize(string sizeString, bool defaultToBinaryPrefix) { + if (sizeString.IsNullOrWhiteSpace()) + { + return 0; + } + if (sizeString.All(char.IsDigit)) { return long.Parse(sizeString);