Fixed: Size parsing of empty description from torrent RSS feeds

Mark McDowall 7 years ago
parent c70740e3b6
commit b8001943b4
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Evolution World</title>
<description>Advanced RSS Feed for xbtitFM by Petr1fied</description>
<link>http://ew.pw</link>
<lastBuildDate>Tue, 15 Aug 2017 00:00:00 +0000</lastBuildDate>
<copyright>(c) 2017 Evolution World</copyright>
<atom:link href="http://ew.pw/advanced_rss.php?cats=34%3B35%3B36%3B37%3B38%3B39%3B41%3B48%3B49%3B50%3B51%3B79%3B80%3B81&amp;tpc=100&amp;auth=secret" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[[TVShow --> TVShow Bluray 720p] Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER [SEEDERS (3)/LEECHERS (0)]]]></title>
<description><![CDATA[<br />Fargo S01 Complete Season 1 720p BRRip DD5.1 x264-PSYPHER<br /><br /><br /><br />Plot:<br /><br />Various chronicles of deception, intrigue and murder in and around frozen Minnesota.<br /><br />Note::-<br />Encode is tested and its perfect, no sync issue there in any episode.<br />All episodes comes with AC3 Audio for better audio and video plaback and English Subs are muxed in video .<br /><br />TECHNiCAL Information:<br /><br /><br />RUNTIME..................: 1 hr x 10<br />Total SIZE...............: 9.75 GiB<br />Total Episodes...........: 10<br />VIDEO CODEC..............: x264 2nd Pass (High,L4.1)<br />RESOLUTION...............: 1280x720<br />BITRATE (Video)..........: 2100 Kbps - 2400 kbps<br />Aspect Ratio.............: 16:9<br />Video Container..........: MKV<br />FRAMERATE................: 23.967 fps<br />AUDIO....................: English AC3 6 Channel 384 kbps<br />SUBTITLES................: English, English (SDH)<br />CHAPTERS.................: Yes<br />SOURCE...................: DON (Thanks !)<br /><br /><br />GENRE...................: Crime | Drama | Thriller<br />RATING..................: 9.1/10 from 140,765 users<br />IMDB link...............: <a href=&quot;http://www.imdb.com/title/tt2802850/&quot; target=&quot;_blank&quot;>http://www.imdb.com/title/tt2802850/</a>]]></description>
<link>http://ew.pw/index.php?page=torrent-details&amp;id=dea071a7a62a0d662538d46402fb112f30b8c9fa</link>
<guid>http://ew.pw/index.php?page=torrent-details&amp;id=dea071a7a62a0d662538d46402fb112f30b8c9fa</guid>
<enclosure url="http://ew.pw/download.php?id=dea071a7a62a0d662538d46402fb112f30b8c9fa&amp;f=Fargo%20S01%20Complete%20Season%201%20720p%20BRRip%20DD5.1%20x264-PSYPHER.torrent&amp;auth=secret" length="13625" type="application/x-bittorrent" />
<pubDate>Sun, 13 Aug 2017 22:21:43 +0000</pubDate>
</item>
<item>
<title><![CDATA[[TVShow --> TVShow Bluray 720p] American Horror Story S04 Complete Season 4 720p BRRip DD5.1 x264 - PSYPHER [SEEDERS (2)/LEECHERS (0)]]]></title>
<description><![CDATA[]]></description>
<link>http://ew.pw/index.php?page=torrent-details&amp;id=2725fe19ea2addf5aafbd523d134191b8abbb2ee</link>
<guid>http://ew.pw/index.php?page=torrent-details&amp;id=2725fe19ea2addf5aafbd523d134191b8abbb2ee</guid>
<enclosure url="http://ew.pw/download.php?id=2725fe19ea2addf5aafbd523d134191b8abbb2ee&amp;f=American%20Horror%20Story%20S04%20Complete%20Season%204%20720p%20BRRip%20DD5.1%20x264%20-%20PSYPHER.torrent&amp;auth=secret" length="16583" type="application/x-bittorrent" />
<pubDate>Fri, 28 Jul 2017 16:29:51 +0000</pubDate>
</item>
</channel>
</rss>

@ -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);

@ -261,6 +261,33 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
torrentInfo.DownloadUrl.Should().Be("https://alpharatio.cc/torrents.php?action=download&authkey=private_auth_key&torrent_pass=private_torrent_pass&id=465831");
}
[Test]
public void should_parse_recent_feed_from_EveolutionWorld_without_size()
{
Subject.Definition.Settings.As<TorrentRssIndexerSettings>().AllowZeroSize = true;
GivenRecentFeedResponse("TorrentRss/EvolutionWorld.xml");
var releases = Subject.FetchRecent();
releases.Should().HaveCount(2);
releases.First().Should().BeOfType<TorrentInfo>();
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()
{

@ -432,6 +432,10 @@
<Link>sqlite3.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Indexers\TorrentRss\EvolutionWorld.xml">
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Indexers\TorrentRss\AlphaRatio.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>

@ -343,6 +343,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);

Loading…
Cancel
Save