Пример #1
0
        private static async Task <BiliBangumiMaster> GetBangumiMasterAsync(string url, string sessdata)
        {
            var json = await HttpHelper.GetJsonAsync(url, sessdata);

            if (json.code != 0)
            {
                throw new ParsingVideoException();
            }

            var list = new List <BiliBangumi>();
            int i    = 1;

            foreach (var b in json.result.episodes)
            {
                var video = new BiliVideo()
                {
                    Av    = b.aid,
                    Bv    = b.bvid,
                    Cid   = b.cid,
                    Title = json.result.season_title,
                    Name  = b.long_title,
                    Order = i
                };
                var bangumi = new BiliBangumi()
                {
                    EpisodeId = b.id,
                    Title     = video.Title,
                    Name      = video.Name,
                    Order     = i,
                    CoverUrl  = b.cover,
                    Video     = video
                };
                list.Add(bangumi);
                i++;
            }
            var master = new BiliBangumiMaster()
            {
                SeasonId       = json.result.season_id,
                MediaId        = json.result.media_id,
                Title          = json.result.season_title,
                Evaluate       = json.result.evaluate,
                CoverUrl       = json.result.cover,
                BGCoverUrl     = json.result.bkg_cover,
                SquareCoverUrl = json.result.square_cover,
                MediaType      = (MediaType)(int)json.result.type,
                EpisodeList    = list.ToArray()
            };

            return(master);
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (e.Parameter is not BiliBangumiMaster)
     {
         return;
     }
     _master = (BiliBangumiMaster)e.Parameter;
     Title   = _master.Title;
     BangumiListView.ItemsSource = _master.EpisodeList;
     try
     {
         CoverImage.Source = new BitmapImage(new Uri(_master.CoverUrl));
     }
     catch
     {
     }
 }