diff --git a/src/NzbDrone.Core.Test/IndexerTests/BroadcastheNetTests/BroadcastheNetFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/BroadcastheNetTests/BroadcastheNetFixture.cs index fefd10da5..d15fb3e85 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/BroadcastheNetTests/BroadcastheNetFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/BroadcastheNetTests/BroadcastheNetFixture.cs @@ -53,7 +53,7 @@ public void should_parse_recent_feed_from_BroadcastheNet() torrentInfo.InfoHash.Should().Be("123"); torrentInfo.TvRageId.Should().Be(4055); torrentInfo.MagnetUrl.Should().BeNullOrEmpty(); - torrentInfo.Peers.Should().Be(9); + torrentInfo.Peers.Should().Be(40+9); torrentInfo.Seeders.Should().Be(40); } diff --git a/src/NzbDrone.Core.Test/IndexerTests/NyaaTests/NyaaFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NyaaTests/NyaaFixture.cs index e2f4f3b14..da1be3630 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NyaaTests/NyaaFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NyaaTests/NyaaFixture.cs @@ -50,7 +50,7 @@ public void should_parse_recent_feed_from_Nyaa() torrentInfo.Size.Should().Be(2523293286); //2.35 GiB torrentInfo.InfoHash.Should().Be(null); torrentInfo.MagnetUrl.Should().Be(null); - torrentInfo.Peers.Should().Be(2); + torrentInfo.Peers.Should().Be(2+1); torrentInfo.Seeders.Should().Be(1); } } diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorrentleechTests/TorrentleechFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorrentleechTests/TorrentleechFixture.cs index 6c1a44d07..829006cbc 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorrentleechTests/TorrentleechFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorrentleechTests/TorrentleechFixture.cs @@ -50,7 +50,7 @@ public void should_parse_recent_feed_from_Torrentleech() torrentInfo.Size.Should().Be(0); torrentInfo.InfoHash.Should().Be(null); torrentInfo.MagnetUrl.Should().Be(null); - torrentInfo.Peers.Should().Be(7); + torrentInfo.Peers.Should().Be(7+1); torrentInfo.Seeders.Should().Be(1); } } diff --git a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs index 96ab86226..3ce6fa66f 100644 --- a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs +++ b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetParser.cs @@ -59,7 +59,7 @@ public IList ParseResponse(IndexerResponse indexerResponse) //torrentInfo.MagnetUrl = torrentInfo.InfoHash = torrent.InfoHash; torrentInfo.Seeders = torrent.Seeders; - torrentInfo.Peers = torrent.Leechers; + torrentInfo.Peers = torrent.Leechers + torrent.Seeders; results.Add(torrentInfo); } diff --git a/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs b/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs index c10331478..017a1a89e 100644 --- a/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs +++ b/src/NzbDrone.Core/Indexers/EzrssTorrentRssParser.cs @@ -65,7 +65,7 @@ protected override String GetMagnetUrl(XElement item) return (Int32)seeds; } - return base.GetPeers(item); + return base.GetSeeders(item); } protected override Int32? GetPeers(XElement item) diff --git a/src/NzbDrone.Core/Indexers/TorrentRssParser.cs b/src/NzbDrone.Core/Indexers/TorrentRssParser.cs index 7de611fa0..a73ab70b5 100644 --- a/src/NzbDrone.Core/Indexers/TorrentRssParser.cs +++ b/src/NzbDrone.Core/Indexers/TorrentRssParser.cs @@ -46,11 +46,19 @@ protected virtual String GetMagnetUrl(XElement item) { if (ParseSeedersInDescription) { - var match = ParseSeedersRegex.Match(item.Element("description").Value); + var matchSeeders = ParseSeedersRegex.Match(item.Element("description").Value); - if (match.Success) + if (matchSeeders.Success) { - return Int32.Parse(match.Groups["value"].Value); + return Int32.Parse(matchSeeders.Groups["value"].Value); + } + + var matchPeers = ParsePeersRegex.Match(item.Element("description").Value); + var matchLeechers = ParseLeechersRegex.Match(item.Element("description").Value); + + if (matchPeers.Success && matchLeechers.Success) + { + return Int32.Parse(matchPeers.Groups["value"].Value) - Int32.Parse(matchLeechers.Groups["value"].Value); } } @@ -61,11 +69,19 @@ protected virtual String GetMagnetUrl(XElement item) { if (ParseSeedersInDescription) { - var match = ParsePeersRegex.Match(item.Element("description").Value); + var matchPeers = ParsePeersRegex.Match(item.Element("description").Value); - if (match.Success) + if (matchPeers.Success) { - return Int32.Parse(match.Groups["value"].Value); + return Int32.Parse(matchPeers.Groups["value"].Value); + } + + var matchSeeders = ParseSeedersRegex.Match(item.Element("description").Value); + var matchLeechers = ParseLeechersRegex.Match(item.Element("description").Value); + + if (matchSeeders.Success && matchLeechers.Success) + { + return Int32.Parse(matchSeeders.Groups["value"].Value) + Int32.Parse(matchLeechers.Groups["value"].Value); } } @@ -73,6 +89,7 @@ protected virtual String GetMagnetUrl(XElement item) } private static readonly Regex ParseSeedersRegex = new Regex(@"(Seeder)s?:\s+(?\d+)|(?\d+)\s+(seeder)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly Regex ParsePeersRegex = new Regex(@"(Leecher|Peer)s?:\s+(?\d+)|(?\d+)\s+(leecher|peer)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex ParseLeechersRegex = new Regex(@"(Leecher)s?:\s+(?\d+)|(?\d+)\s+(leecher)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex ParsePeersRegex = new Regex(@"(Peer)s?:\s+(?\d+)|(?\d+)\s+(peer)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled); } }