private void ValidateReleaseSize(TorrentInfo[] releases, TorrentRssIndexerSettings indexerSettings) { if (!indexerSettings.AllowZeroSize && releases.Any(r => r.Size == 0)) { throw new UnsupportedFeedException("Feed doesn't contain the release content size."); } if (releases.Any(r => r.Size != 0 && r.Size < ValidSizeThreshold)) { throw new UnsupportedFeedException("Size of one more releases lower than {0}, feed must contain release content size.", ValidSizeThreshold.SizeSuffix()); } }
private void ValidateReleases(TorrentInfo[] releases, TorrentRssIndexerSettings indexerSettings) { if (releases == null || releases.Empty()) { throw new UnsupportedFeedException("Empty feed, cannot check if feed is parsable."); } var torrentInfo = releases.First(); _logger.Trace("TorrentInfo: \n{0}", torrentInfo.ToString("L")); if (releases.Any(r => r.Title.IsNullOrWhiteSpace())) { throw new UnsupportedFeedException("Feed contains releases without title."); } if (releases.Any(r => !IsValidDownloadUrl(r.DownloadUrl))) { throw new UnsupportedFeedException("Failed to find a valid download url in the feed."); } var total = releases.Where(v => v.Guid != null).Select(v => v.Guid).ToArray(); var distinct = total.Distinct().ToArray(); if (distinct.Length != total.Length) { throw new UnsupportedFeedException("Feed contains releases with same guid, rejecting malformed rss feed."); } }