From 9ef700df46d1cbf16dd5ef09053675428eed9428 Mon Sep 17 00:00:00 2001 From: real-zony Date: Thu, 6 Jan 2022 15:27:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BD=93=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E6=AD=8C=E8=AF=8D=E6=B2=A1=E6=9C=89=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E5=AF=BC=E8=87=B4=20NULL=20=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=BC=82=E5=B8=B8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/real-zony/ZonyLrcToolsX/issues/82 Closes https://github.com/real-zony/ZonyLrcToolsX/issues/83 --- .../Lyric/NetEase/NetEaseLyricDownloader.cs | 7 ++++++- .../Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/NetEase/NetEaseLyricDownloader.cs b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/NetEase/NetEaseLyricDownloader.cs index 3ffe104..1bc167c 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/NetEase/NetEaseLyricDownloader.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/NetEase/NetEaseLyricDownloader.cs @@ -64,9 +64,14 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.NetEase return new LyricItemCollection(LyricItemCollectionOption.NullInstance); } + if (json.OriginalLyric.Text.Contains("纯音乐,请欣赏")) + { + return new LyricItemCollection(null); + } + return _lyricItemCollectionFactory.Build( json.OriginalLyric.Text, - json.TranslationLyric.Text); + json.TranslationLyric?.Text); } protected virtual void ValidateSongSearchResponse(SongSearchResponse response, LyricDownloaderArgs args) diff --git a/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs b/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs index 26957ff..844a250 100644 --- a/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs +++ b/tests/ZonyLrcTools.Tests/Infrastructure/Lyric/NetEaseLyricDownloaderTests.cs @@ -34,5 +34,13 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyric lyric.IsPruneMusic.ShouldBe(false); lyric.ToString().Contains("惑う心繋ぎ止める").ShouldBeTrue(); } + + [Fact] + public async Task DownloadAsync_Issue_82_Test() + { + var lyric = await _lyricDownloader.DownloadAsync("シンデレラ (Giga First Night Remix)", "DECO 27 ギガP"); + lyric.ShouldNotBeNull(); + lyric.IsPruneMusic.ShouldBe(true); + } } } \ No newline at end of file