Esempio n. 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="topId"></param>
        /// <param name="offset"></param>
        /// <param name="num"></param>
        public async Task InitFromJsonAsync(int topId, int offset, int num)
        {
            string res = await HttpClientHelper.GetAsync(MusicApi.GetTopList(topId, offset, num));

            try
            {
                JObject json = JObject.Parse(res);
                Date          = json["date"].ToString();
                TopId         = topId;
                Cursor        = json["cur_song_num"].ToObject <int>();
                TotalSong     = json["total_song_num"].ToObject <int>();
                Name          = json["topinfo"]["ListName"].ToString();
                Listennum     = json["topinfo"]["listennum"].ToString();
                H5CoverUrl    = json["topinfo"]["pic_h5"].ToString();
                AlbumCoverUrl = json["topinfo"]["pic_album"].ToString();
                Info          = json["topinfo"]["info"].ToString();
                var list = json["songlist"];
                if (list.Any())
                {
                    foreach (var song in list)
                    {
                        Song son = new Song();
                        son.Time = song["data"]["interval"].ToString();
                        var singers   = song["data"]["singer"];
                        var oneSinger = singers.First;
                        son.Singer = new Singer()
                        {
                            Id   = oneSinger["id"].ToString(),
                            Name = oneSinger["name"].ToString(),
                            MId  = oneSinger["mid"].ToString()
                        };
                        son.Id    = song["data"]["songid"].ToString();
                        son.MId   = song["data"]["songmid"].ToString();
                        son.Name  = song["data"]["songname"].ToString();
                        son.Album = new Album()
                        {
                            AlbumId  = song["data"]["albumid"].ToString(),
                            Name     = song["data"]["albumname"].ToString(),
                            Desc     = song["data"]["albumdesc"].ToString(),
                            CoverUrl = ""
                        };
                        Songs.Add(son);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //IndexData data=new IndexData();
            //data.GetIndexData();
            var dsdasdas = MusicApi.GetIndexList();
            var fdf      = HttpClientHelper.GetAsync(dsdasdas).Result;
            var resss    = SearchApi.GetKeySuggest("李");
            var str      = MusicApi.GetKeySuggesUrl("修炼爱情");
            var ss       = HttpClientHelper.GetAsync(str).Result;
            var swe      = MusicApi.GetHotKey();
            var sdsad    = HttpClientHelper.GetAsync(swe).Result;
            var sds      = AlbumApi.InitBriefInfoAlbumAsync("2265047").Result;
            //var sss =
            //    MusicApi.GetSingerAlbum("000GGDys0yA0Nk", 0, 10);
            var     bir     = ImageHelper.DownAsync("http://y.gtimg.cn/music/photo_new/T002R500x500M000004Z9rf305fzyj.jpg").Result;
            SongApi songApi = new SongApi();

            songApi.InitAllListAsync().Wait();
            var lis = songApi.GetCover();

            foreach (var song in lis)
            {
                song.Album.GetAllInfor.BeginInvoke(string.Empty, null, null);
            }
            TopList top = new TopList();

            top.InitFromJsonAsync(4, 0, 10).Wait();
            var sss = MusicApi.GetTopList(4, 0, 30);

            var ssss = HttpClientHelper.GetAsync(sss).Result;

            JObject json = JObject.Parse(ssss);
            var     list = json["songlist"];

            foreach (var VARIABLE in list)
            {
            }

            var s = MusicApi.GetMusicianUrl(1, 200, NetMusic.Mode.MusicianType.cn_man, "L");

            var tt = HttpClientHelper.GetAsync(s).Result;
        }