Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
1.修复音乐下载连接失效
Browse files Browse the repository at this point in the history
2.修复伴奏下载连接失效
3.添加m4a格式的下载
  • Loading branch information
hzexe committed Mar 27, 2019
1 parent db6d90c commit 7956407
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 74 deletions.
2 changes: 2 additions & 0 deletions Example/Basic-Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ static void Main(string[] args)
downloadType |= (type & EnumFileType.Mp3_320k);
if (downloadType == 0)
downloadType |= (type & EnumFileType.Mp3_128k);
if (downloadType == 0)
downloadType |= (type & EnumFileType.M4a);

var t = api.downloadSongAsync(song, dir, downloadType);//建立下载的task,下载文件最大并保存到当前目录
//可选:当然也可以尝试lrc的歌词下载下来
Expand Down
140 changes: 76 additions & 64 deletions Example/WindowsFormsApp/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Example/WindowsFormsApp/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private async void button1_Click(object sender, EventArgs e)
Flac = ( x.file.size_flac > 0) ? "下载" : null,
Mp3_128k = ( x.file.size_128 > 0) ? "下载" : null,
Mp3_320k = ( x.file.size_320 > 0) ? "下载" : null,
M4a = (x.file.size_aac > 0) ? "下载" : null,
});


Expand Down Expand Up @@ -167,6 +168,10 @@ private void dataGridView1_CellContentClick(object sender, DataGridViewCellEvent
{
fun(EnumFileType.Mp3_128k, si);
}
else if ("M4a" == col.DataPropertyName)
{
fun(EnumFileType.M4a, si);
}
else if ("Play" == col.DataPropertyName)
{
EnumFileType type = si.file.GetAvailableFileType();//取当前歌曲可用的类型
Expand All @@ -178,6 +183,9 @@ private void dataGridView1_CellContentClick(object sender, DataGridViewCellEvent
downloadType |= (type & EnumFileType.Mp3_320k);
if (downloadType == 0)
downloadType |= (type & EnumFileType.Mp3_128k);
if (downloadType == 0)
downloadType |= (type & EnumFileType.M4a);



string url = api.GetDownloadSongUrl(si, downloadType);
Expand Down
3 changes: 3 additions & 0 deletions Example/WindowsFormsApp/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<metadata name="Mp3_320k.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="M4a.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Ape.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down
2 changes: 2 additions & 0 deletions Example/WindowsFormsApp/TableModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class TableModel
public string Flac { get; set; }
[DisplayName("Mp3_320k")]
public string Mp3_320k { get; set; }
[DisplayName("M4a")]
public string M4a { get; set; }
[DisplayName("Api格式")]
public string Mp3_128k { get; set; }
[DisplayName("高质量试听")]
Expand Down
2 changes: 2 additions & 0 deletions Example/Windows_x64/Windows_x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ int main()
downloadType = Flac;
else if (type&Mp3_320k)
downloadType = Mp3_320k;
else if (type&m4a)
downloadType = m4a;
else
downloadType = Mp3_128k;
const wchar_t dir[] = L"./"; //下载存放的目录
Expand Down
Loading

0 comments on commit 7956407

Please # to comment.