Skip to content

Commit 1cb9239

Browse files
author
jadepeng
committed
增加全选,增加网易歌手列表
1 parent 5fc1c9d commit 1cb9239

File tree

3 files changed

+62
-6
lines changed

3 files changed

+62
-6
lines changed

XMusicDownloader/Form1.Designer.cs

Lines changed: 29 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

XMusicDownloader/Form1.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Form1()
3232
private void Form1_Load(object sender, EventArgs e)
3333
{
3434
textBox2.Text = target;
35-
this.cbRate.SelectedIndex = 0;
35+
this.cbRate.SelectedIndex = 2;
3636
}
3737

3838
//浏览
@@ -272,5 +272,13 @@ private void btnGetSongList_Click(object sender, EventArgs e)
272272
{
273273
GetList(1);
274274
}
275+
276+
private void cbSelectAll_CheckedChanged(object sender, EventArgs e)
277+
{
278+
foreach (ListViewItem item in resultListView.Items)
279+
{
280+
item.Checked = cbSelectAll.Checked;
281+
}
282+
}
275283
}
276284
}

XMusicDownloader/Provider/NeteaseProvider.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public List<Song> SearchSongs(string keyword, int page, int pageSize)
5555

5656
}
5757

58+
// https://music.163.com/#/artist?id=10559
59+
5860
public bool Support(string url)
5961
{
6062
if (url == null)
@@ -67,7 +69,7 @@ public bool Support(string url)
6769
return false;
6870
}
6971

70-
return url.StartsWith("https://music.163.com/#/playlist?id=") || url.StartsWith("https://music.163.com/#/album?id=");
72+
return url.StartsWith("https://music.163.com/#/playlist?id=") || url.StartsWith("https://music.163.com/#/album?id=") || url.StartsWith("https://music.163.com/#/artist?id=");
7173
}
7274

7375
Regex regex = new Regex("id=(\\d+)");
@@ -84,16 +86,36 @@ public List<Song> GetSongList(string url)
8486
{
8587
GetSongListDetail(id, result);
8688
}
87-
else
89+
else if(url.StartsWith("https://music.163.com/#/album?id="))
8890
{
8991
GetAlbum(id, result);
9092
}
93+
else
94+
{
95+
GetSinger(id, result);
96+
}
9197

9298

9399
return result;
94100

95101
}
96102

103+
private void GetSinger(string id, List<Song> result)
104+
{
105+
var requestUrl = "https://v1.itooi.cn/netease/song/artist?id=" + id + "&pageSize=200";
106+
var searchResult = HttpHelper.GET(requestUrl, DEFAULT_CONFIG);
107+
108+
var songList = JObject.Parse(searchResult)["data"];
109+
var index = 1;
110+
111+
foreach (var songItem in songList)
112+
{
113+
Song song = extractSong(ref index, songItem);
114+
result.Add(song);
115+
116+
}
117+
}
118+
97119
private void GetAlbum(string id, List<Song> result)
98120
{
99121
var requestUrl = "https://v1.itooi.cn/netease/album?id=" + id;

0 commit comments

Comments
 (0)