コード例 #1
0
ファイル: MejorTorrent.cs プロジェクト: Akuma737/Jackett
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: MejorTorrent.cs プロジェクト: ivanbeldad/Jackett
        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));
        }