Esempio n. 1
0
        public static async Task DownloadSpotlight(SpotlightArticle article)
        {
            var root = TextBuffer.GetOrCreateDirectory(Path.Combine(Settings.Global.DownloadLocation, "Spotlight", article.Title));

            var tasks  = (await PixivClient.Instance.GetArticleWorks(article.Id.ToString())).Select(PixivHelper.IllustrationInfo).Where(i => i != null);
            var result = await Task.WhenAll(tasks);

            await Task.WhenAll(result.Select(t => DownloadIllust(t, root)));
        }
Esempio n. 2
0
        public static string GetSpotlightCover(SpotlightArticle article)
        {
            // var match = Regex.Match(article.Thumbnail, "/(?<illust_id>\\d+)_p\\d+_master1200\\.jpg|png");
            // if (match.Success)
            // {
            //     var url = Regex.Replace(article.Thumbnail, "/c/\\d+x\\d+_\\d+/img-master/", "/img-original/").Replace("_master1200", string.Empty);
            //     return url;
            // }

            return(article.Thumbnail);
        }
Esempio n. 3
0
        public static async Task DownloadSpotlight(SpotlightArticle article)
        {
            var root = Directory.CreateDirectory(Path.Combine(Settings.Global.DownloadLocation, "Spotlight", article.Title)).FullName;

            var result = await Tasks <string, Illustration> .Of(await PixivClient.Instance.GetArticleWorks(article.Id.ToString()))
                         .Mapping(PixivHelper.IllustrationInfo)
                         .Construct()
                         .WhenAll();

            await Task.WhenAll(result.Select(t => DownloadIllust(t, root)));
        }
Esempio n. 4
0
        public static async Task DownloadSpotlight(SpotlightArticle article)
        {
            var root = TextBuffer.GetOrCreateDirectory(Path.Combine(Settings.Global.DownloadLocation, "Spotlight", article.Title));

            var illusts = await PixivClient.Instance.GetArticleWorks(article.Id.ToString());

            var list = new List <Task>();

            foreach (var illust in illusts)
            {
                var illustration = await PixivHelper.IllustrationInfo(illust);

                if (illustration != null)
                {
                    list.Add(DownloadIllust(illustration, root));
                }
            }

            await Task.WhenAll(list);
        }
Esempio n. 5
0
 public static string DownloadSpotlightComplete(SpotlightArticle spotlight)
 {
     return($"{spotlight.Id}已经下载到{Path.Combine(Settings.Global.DownloadLocation, "Spotlight")}");
 }