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))); }
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); }
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))); }
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); }
public static string DownloadSpotlightComplete(SpotlightArticle spotlight) { return($"{spotlight.Id}已经下载到{Path.Combine(Settings.Global.DownloadLocation, "Spotlight")}"); }