Ejemplo n.º 1
0
        private void FindAction(ScraperBase scraper)
        {
            var searchOptions   = (SearchSettingsBase)PGrid_Bot.SelectedObject;
            var convertedFilter = searchOptions;

            if (searchOptions.GetType() != scraper.SearchSettingsType)
            {
                convertedFilter = SearchSettingsBase.ConvertToChild(searchOptions, scraper.SearchSettingsType);
            }

            scraper.ScrapeItems(out var products, convertedFilter, _findTokenSource.Token);
            if (AppSettings.Default.PostStartMessage)
            {
                products.AsParallel().ForAll(product =>
                {
                    var pDetails = product.GetDetails(_findTokenSource.Token);
                    pDetails.Validate();
                    PostProduct(pDetails);
                });
            }


            DGrid_FoundProducts.Invoke(new Action(() =>
            {
                lock (_listOfProducts)
                {
                    products.ForEach(product => _listOfProducts.Add(product));
                    _findTokenSource.Token.ThrowIfCancellationRequested();
                }
            }));
        }
Ejemplo n.º 2
0
        private string ShortenLinkTitle(string title)
        {
            if (String.IsNullOrWhiteSpace(title))
            {
                return(title);
            }
            title = title.ToLower();
            var text = ScraperBase.Substring(title, "part");

            if (String.IsNullOrWhiteSpace(text))
            {
                return(" Full Movie");
            }
            return("Part - " + text);
        }