Exemple #1
0
        public static async Task <Pixeez.Objects.UgoiraInfo> GetUgoiraMetaInfo(this PixivItem item)
        {
            Pixeez.Objects.UgoiraInfo result = null;
            long id = 0;

            if (item.IsWork() && long.TryParse(item.ID, out id))
            {
                if (item.Ugoira is Pixeez.Objects.UgoiraInfo)
                {
                    result = item.Ugoira;
                }
                else if (item.Illust.UgoiraMeta is Pixeez.Objects.UgoiraInfo)
                {
                    result      = item.Illust.UgoiraMeta;
                    item.Ugoira = result;
                }
                else
                {
                    result = await GetUgoiraMetaInfo(id);

                    item.Illust.UgoiraMeta = result;
                    item.Ugoira            = result;
                }
            }
            return(result);
        }
        private async Task <List <string> > GetPagesOriginalItems(PixivItem item)
        {
            List <string> pages = new List <string>();

            try
            {
                if (Options.IncludePagePreview)
                {
                    if (item.IsPage() || item.IsPages())
                    {
                        var setting = Application.Current.LoadSetting();
                        pages.Add(item.Illust.GetOriginalUrl(item.Index));
                    }
                    else if (item.IsWork())
                    {
                        var illust = item.Illust;
                        if (illust is Pixeez.Objects.Work && (illust.PageCount ?? 0) > 1)
                        {
                            if (illust is Pixeez.Objects.IllustWork)
                            {
                                var subset = illust as Pixeez.Objects.IllustWork;
                                if (subset.meta_pages.Count() > 1)
                                {
                                    foreach (var page in subset.meta_pages)
                                    {
                                        pages.Add(page.GetOriginalUrl());
                                    }
                                }
                            }
                            else if (illust is Pixeez.Objects.NormalWork)
                            {
                                var subset = illust as Pixeez.Objects.NormalWork;
                                if ((subset.PageCount ?? 0) >= 1 && subset.Metadata == null)
                                {
                                    subset.Metadata = await subset.GetMetaData();

                                    //illust = await illust.RefreshIllust();
                                }
                                if (illust != null && illust.Metadata is Pixeez.Objects.Metadata)
                                {
                                    item.Illust = illust;
                                    foreach (var page in illust.Metadata.Pages)
                                    {
                                        pages.Add(page.GetOriginalUrl());
                                    }
                                }
                            }
                            pages = pages.Distinct().ToList();
                        }
                    }
                }
            }
            catch (Exception ex) { ex.ERROR("PAGESCOUNTING"); }
            return(pages);
        }