From 6361bf9265cc62abf01c35539140b2bb13dfd21f Mon Sep 17 00:00:00 2001 From: real-zony Date: Wed, 24 May 2023 23:08:17 +0800 Subject: [PATCH] feat: Improved the result information for lyrics download. --- src/ZonyLrcTools.Common/Lyrics/LyricsDownloader.cs | 6 +++++- src/ZonyLrcTools.Common/MusicInfo.cs | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ZonyLrcTools.Common/Lyrics/LyricsDownloader.cs b/src/ZonyLrcTools.Common/Lyrics/LyricsDownloader.cs index c1be905..7516da4 100644 --- a/src/ZonyLrcTools.Common/Lyrics/LyricsDownloader.cs +++ b/src/ZonyLrcTools.Common/Lyrics/LyricsDownloader.cs @@ -67,7 +67,10 @@ public class LyricsDownloader : ILyricsDownloader, ISingletonDependency await Task.WhenAll(downloadTasks); - await _logger.InfoAsync($"歌词数据下载完成,成功: {needDownloadMusicInfos.Count(m => m.IsSuccessful)} 失败{needDownloadMusicInfos.Count(m => m.IsSuccessful == false)}。"); + var successfulCount = needDownloadMusicInfos.Count(m => m is { IsSuccessful: true, IsPruneMusic: false }); + var skippedCount = needDownloadMusicInfos.Count(m => m is { IsSuccessful: true, IsPruneMusic: true }); + var failedCount = needDownloadMusicInfos.Count(m => m.IsSuccessful == false); + await _logger.InfoAsync($"歌词数据下载完成,成功: {successfulCount} 跳过(纯音乐): {skippedCount} 失败{failedCount}。"); await LogFailedSongFilesInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"歌词下载失败列表_{DateTime.Now:yyyyMMddHHmmss}.txt"), needDownloadMusicInfos); } @@ -80,6 +83,7 @@ public class LyricsDownloader : ILyricsDownloader, ISingletonDependency if (lyrics.IsPruneMusic) { info.IsSuccessful = true; + info.IsPruneMusic = true; return; } diff --git a/src/ZonyLrcTools.Common/MusicInfo.cs b/src/ZonyLrcTools.Common/MusicInfo.cs index 0b79324..060b677 100644 --- a/src/ZonyLrcTools.Common/MusicInfo.cs +++ b/src/ZonyLrcTools.Common/MusicInfo.cs @@ -32,6 +32,11 @@ namespace ZonyLrcTools.Common /// public bool IsSuccessful { get; set; } = true; + /// + /// 是否时纯音乐? + /// + public bool IsPruneMusic { get; set; } = false; + /// /// 构建一个新的 对象。 ///