Esempio n. 1
0
        private async Task Scrap(int index)
        {
            SetStatus("Scraping Images...");

            Size minSize = new Size(Settings.Default.MinWidth, Settings.Default.MinHeight);

            ImageScraper.GetImageURLs(urls[index].URL, async(imgUrl, size) =>
            {
                if (imgUrl == null)
                {
                    SetStatus("Idle");
                    return;
                }
                if ((size.Width > 0 && size.Width < minSize.Width) || (size.Height > 0 && size.Height < minSize.Height))
                {
                    return;
                }
                ImageWrapper iw;
                if (!Cache.Lookup(imgUrl, out iw))
                {
                    iw = new ImageWrapper(imgUrl);
                    iw.RecommendationMade += recMade;
                    Cache.Stash(imgUrl, iw);
                }
                await iw.RetrieveLabels();
                await iw.RetrieveMatches();
                urls[index].AddChild(iw);
            });
        }
Esempio n. 2
0
        public static async Task GetSimilar(string[] labels, Action <string, Size> callback)
        {
            string urlQuery = HttpUtility.UrlEncode(String.Join(" ", labels));

            string url = String.Format(Settings.Default.LookupQuery, urlQuery);

            await ImageScraper.GetImageURLs(url, callback);
        }