예제 #1
0
        public IActionResult Search(string keyword)
        {
            MusicProviders    provider = MusicProviders.Instance;
            List <MergedSong> list     = provider.SearchSongs(keyword, 1, 20);

            foreach (var item in list)
            {
                foreach (var item2 in item.items)
                {
                    item2.url = provider.getDownloadUrl(item2);
                }
            }
            return(View(list));
        }
예제 #2
0
        public void Download()
        {
            WebClient client = new WebClient();

            client.DownloadProgressChanged += Client_DownloadProgressChanged;
            new Thread(() =>
            {
                // 多来源,防止单个来源出错
                foreach (var item in song.items)
                {
                    try
                    {
                        client.DownloadFile(musicProviders.getDownloadUrl(item), target + "\\" + item.getFileName());
                        DownloadFinish?.Invoke(this, this);
                        break;
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }).Start();
        }
예제 #3
0
 private string getSongUrl(Song song)
 {
     return(provider.getDownloadUrl(song));
 }