Exemplo n.º 1
0
        public IEnumerable <SerieLink> AllSeries()
        {
            OmgTorrentCrawler crawler = new OmgTorrentCrawler();
            var series = crawler.CollectSeriesUrls();

            return(series);
        }
Exemplo n.º 2
0
        public IEnumerable <TorrentLink> GetTorrents(SerieLink serie)
        {
            List <TorrentLink> torrents = new List <TorrentLink>();
            OmgTorrentCrawler  crawler  = new OmgTorrentCrawler();
            var task = crawler.CollectSerieTorrents(serie.Url);

            task.ConfigureAwait(false);
            var results = task.Result;

            if (results != null)
            {
                foreach (var torrent in results)
                {
                    torrent.SerieLinkId = serie.Id;
                }
                torrents.AddRange(results);
            }
            return(torrents);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Search torrents related to a serie containing <paramref name="term"/>
        /// </summary>
        /// <param name="term">a term in the serie title</param>
        /// <returns></returns>
        public IEnumerable <TorrentLink> Search(string term)
        {
            string            searchTerm = term.ToLowerInvariant();
            OmgTorrentCrawler crawler    = new OmgTorrentCrawler();
            var series = crawler.CollectSeriesUrls()
                         .Where(s => s.Title.Contains(searchTerm));

            List <TorrentLink> torrents = new List <TorrentLink>();

            foreach (SerieLink s in series)
            {
                var task = crawler.CollectSerieTorrents(s.Url);
                task.ConfigureAwait(false);
                var results = task.Result;
                if (results != null)
                {
                    torrents.AddRange(results);
                }
            }
            return(torrents);
        }