From be68b3474cd333889706a49a241ae87176731d0c Mon Sep 17 00:00:00 2001 From: real-zony Date: Tue, 22 Mar 2022 22:11:02 +0800 Subject: [PATCH] fix: Fixed the error in the count of failure times. --- src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs | 3 ++- src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs b/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs index d0e829b..7a62826 100644 --- a/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs +++ b/src/ZonyLrcTools.Cli/Commands/SubCommand/DownloadCommand.cs @@ -178,6 +178,7 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand catch (Exception ex) { _logger.LogError($"下载歌词文件时发生错误:{ex.Message},歌曲名: {info.Name},歌手: {info.Artist}。"); + info.IsSuccessful = false; } return true; @@ -207,7 +208,7 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand await Task.WhenAll(warpTaskList); - _logger.LogInformation($"专辑数据下载完成,成功: {musicInfos.Count} 失败{0}。"); + _logger.LogInformation($"专辑数据下载完成,成功: {musicInfos.Count(m => m.IsSuccessful)} 失败{musicInfos.Count(m => !m.IsSuccessful)}。"); } private async Task DownloadAlbumTaskLogicAsync(IAlbumDownloader downloader, MusicInfo info) diff --git a/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs b/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs index 12cf680..6308bc7 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs @@ -20,6 +20,11 @@ namespace ZonyLrcTools.Cli.Infrastructure /// public string Artist { get; set; } + /// + /// 是否下载成功? + /// + public bool IsSuccessful { get; set; } = true; + /// /// 构建一个新的 对象。 ///