refactor: The GenerateLyricAsync method of the Downloader class adds new parameters.

为 Downloader 类的 GenerateLyricAsync 方法添加了新的参数。
This commit is contained in:
real-zony 2021-05-09 22:14:59 +08:00
parent 8f70e434f0
commit 9fe8e1e56c
2 changed files with 4 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric
var args = new LyricDownloaderArgs(songName, artist);
await ValidateAsync(args);
var downloadDataBytes = await DownloadDataAsync(args);
return await GenerateLyricAsync(downloadDataBytes);
return await GenerateLyricAsync(downloadDataBytes, args);
}
protected virtual ValueTask ValidateAsync(LyricDownloaderArgs args)
@ -36,6 +36,6 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric
protected abstract ValueTask<byte[]> DownloadDataAsync(LyricDownloaderArgs args);
protected abstract ValueTask<LyricItemCollection> GenerateLyricAsync(byte[] data);
protected abstract ValueTask<LyricItemCollection> GenerateLyricAsync(byte[] data, LyricDownloaderArgs args);
}
}

View File

@ -19,6 +19,7 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.NetEase
private const string NetEaseSearchMusicUrl = @"https://music.163.com/api/search/get/web";
private const string NetEaseGetLyricUrl = @"https://music.163.com/api/song/lyric";
private const string NetEaseRequestReferer = @"https://music.163.com";
private const string NetEaseRequestContentType = @"application/x-www-form-urlencoded";
@ -54,7 +55,7 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.NetEase
return Encoding.UTF8.GetBytes(lyricResponse);
}
protected override async ValueTask<LyricItemCollection> GenerateLyricAsync(byte[] data)
protected override async ValueTask<LyricItemCollection> GenerateLyricAsync(byte[] data, LyricDownloaderArgs args)
{
await ValueTask.CompletedTask;