From be4380c7443e3f9fba5274c830d291bfc7fde722 Mon Sep 17 00:00:00 2001 From: real-zony Date: Thu, 22 Sep 2022 15:30:28 +0800 Subject: [PATCH] fix: Fixed issue #106. --- .../Commands/SubCommand/DownloadCommand.cs | 14 +++++++------- .../Lyric/NetEaseLyricDownloaderTests.cs | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs b/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs index e18f29a..28271b1 100644 --- a/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs +++ b/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs @@ -67,17 +67,19 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand protected override async Task OnExecuteAsync(CommandLineApplication app) { - var files = await ScanMusicFilesAsync(); - var musicInfos = await LoadMusicInfoAsync(files); - if (DownloadLyric) { - await DownloadLyricFilesAsync(musicInfos); + await DownloadLyricFilesAsync( + await LoadMusicInfoAsync( + RemoveExistLyricFiles( + await ScanMusicFilesAsync()))); } if (DownloadAlbum) { - await DownloadAlbumAsync(musicInfos); + await DownloadAlbumAsync( + await LoadMusicInfoAsync( + await ScanMusicFilesAsync())); } return 0; @@ -95,8 +97,6 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand throw new ErrorCodeException(ErrorCodes.NoFilesWereScanned); } - files = RemoveExistLyricFiles(files); - _logger.LogInformation($"已经扫描到了 {files.Count} 个音乐文件。"); return files; diff --git a/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs b/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs index 2971889..11d3ef7 100644 --- a/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs +++ b/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs @@ -77,5 +77,12 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyric lyric.ShouldNotBeNull(); } + + [Fact] + public async Task DownloaderAsync_Issue101_Test() + { + var lyric = await _lyricDownloader.DownloadAsync("君への嘘", "VALSHE"); + lyric.ShouldNotBeEmpty(); + } } } \ No newline at end of file