public async Task <IEnumerable <ReleaseInfo> > PerformQuery(TorznabQuery query, int attempts) { if (query.SearchTerm == null) { query.SearchTerm = ""; } query.SearchTerm = query.SearchTerm.Replace("'", ""); var requester = new MejorTorrentRequester(this); var tvShowScraper = new TvShowScraper(); var seasonScraper = new SeasonScraper(); var downloadScraper = new DownloadScraper(); var rssScraper = new RssScraper(); var downloadGenerator = new DownloadGenerator(requester, downloadScraper); var tvShowPerformer = new TvShowPerformer(requester, tvShowScraper, seasonScraper, downloadGenerator); var rssPerformer = new RssPerformer(requester, rssScraper, seasonScraper, downloadGenerator); if (string.IsNullOrEmpty(query.SanitizedSearchTerm)) { var releases = await rssPerformer.PerformQuery(query); if (releases.Count() == 0) { releases = await AliveCheck(tvShowPerformer); } return(releases); } return(await tvShowPerformer.PerformQuery(query)); }
public async Task <IEnumerable <ReleaseInfo> > PerformQuery(TorznabQuery query, int attempts) { query = query.Clone(); var originalSearchTerm = query.SearchTerm; if (query.SearchTerm == null) { query.SearchTerm = ""; } query.SearchTerm = query.SearchTerm.Replace("'", ""); var requester = new MejorTorrentRequester(this); var tvShowScraper = new TvShowScraper(); var seasonScraper = new SeasonScraper(); var downloadScraper = new DownloadScraper(); var rssScraper = new RssScraper(); var downloadGenerator = new DownloadGenerator(requester, downloadScraper); var tvShowPerformer = new TvShowPerformer(requester, tvShowScraper, seasonScraper, downloadGenerator); var rssPerformer = new RssPerformer(requester, rssScraper, seasonScraper, downloadGenerator); var movieSearchScraper = new MovieSearchScraper(); var movieInfoScraper = new MovieInfoScraper(); var movieDownloadScraper = new MovieDownloadScraper(); var moviePerformer = new MoviePerformer(requester, movieSearchScraper, movieInfoScraper, movieDownloadScraper); var releases = new List <ReleaseInfo>(); if (string.IsNullOrEmpty(query.SanitizedSearchTerm)) { releases = (await rssPerformer.PerformQuery(query)).ToList(); var movie = releases.First(); movie.Category.Add(TorznabCatType.Movies.ID); releases.ToList().Add(movie); if (releases.Count() == 0) { releases = (await AliveCheck(tvShowPerformer)).ToList(); } return(releases); } if (query.Categories.Contains(TorznabCatType.Movies.ID) || query.Categories.Count() == 0) { releases.AddRange(await moviePerformer.PerformQuery(query)); } if (query.Categories.Contains(TorznabCatType.TV.ID) || query.Categories.Contains(TorznabCatType.TVSD.ID) || query.Categories.Contains(TorznabCatType.TVHD.ID) || query.Categories.Count() == 0) { releases.AddRange(await tvShowPerformer.PerformQuery(query)); } query.SearchTerm = originalSearchTerm; return(releases); }
private async Task <IEnumerable <ReleaseInfo> > AliveCheck(TvShowPerformer tvShowPerformer) { IEnumerable <ReleaseInfo> releases = new List <ReleaseInfo>(); var tests = new Queue <string>(new[] { "stranger things", "westworld", "friends" }); while (releases.Count() == 0 && tests.Count > 0) { var query = new TorznabQuery(); query.SearchTerm = tests.Dequeue(); releases = await tvShowPerformer.PerformQuery(query); } return(releases); }
public async Task <IEnumerable <ReleaseInfo> > PerformQuery(TorznabQuery query, int attempts) { var requester = new MejorTorrentRequester(this); var tvShowScraper = new TvShowScraper(); var seasonScraper = new SeasonScraper(); var downloadScraper = new DownloadScraper(); var rssScraper = new RssScraper(); var downloadGenerator = new DownloadGenerator(requester, downloadScraper); var tvShowPerformer = new TvShowPerformer(requester, tvShowScraper, seasonScraper, downloadGenerator); var rssPerformer = new RssPerformer(requester, rssScraper, seasonScraper, downloadGenerator); if (string.IsNullOrEmpty(query.SanitizedSearchTerm)) { return(await rssPerformer.PerformQuery(query)); } return(await tvShowPerformer.PerformQuery(query)); }