4 Commits

Author SHA1 Message Date
real-zony
9ef700df46 fix: 修复当翻译歌词没有的时候,导致 NULL 引用异常。
Closes https://github.com/real-zony/ZonyLrcToolsX/issues/82
Closes https://github.com/real-zony/ZonyLrcToolsX/issues/83
2022-01-06 15:27:57 +08:00
real-zony
c6a275ce07 feat: 增加歌曲错误提示。 2022-01-05 22:41:14 +08:00
real-zony
1f505f2f72 build: 升级依赖的 McMaster 库。 2021-12-29 11:20:50 +08:00
real-zony
a63115f402 docs: 更新使用文档。
增加使用用例。
2021-12-29 11:20:26 +08:00
6 changed files with 32 additions and 5 deletions

View File

@@ -25,6 +25,15 @@ macOS 和 Linux 用户请打开终端,切换到软件目录,一样执行命
./ZonyLrcTools.Cli.exe download -h|--help ./ZonyLrcTools.Cli.exe download -h|--help
``` ```
**例子**
```shell
# 下载歌词
./ZonyLrcTools.Cli.exe download -d "C:\歌曲目录" -l -n 2
# 下载专辑封面
./ZonyLrcTools.Cli.exe download -d "C:\歌曲目录" -a -n 2
```
#### 加密格式转换 #### 加密格式转换
目前软件支持 NCM、QCM(开发中...🚧) 格式的音乐文件转换,命令如下。 目前软件支持 NCM、QCM(开发中...🚧) 格式的音乐文件转换,命令如下。

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.IO; using System.IO;
@@ -172,6 +173,10 @@ namespace ZonyLrcTools.Cli.Commands
_logger.LogWarningInfo(ex); _logger.LogWarningInfo(ex);
} }
catch (Exception ex)
{
_logger.LogError($"下载歌词文件时发生错误:{ex.Message},歌曲名: {info.Name},歌手: {info.Artist}。");
}
return true; return true;
} }
@@ -206,7 +211,7 @@ namespace ZonyLrcTools.Cli.Commands
private async Task DownloadAlbumTaskLogicAsync(IAlbumDownloader downloader, MusicInfo info) private async Task DownloadAlbumTaskLogicAsync(IAlbumDownloader downloader, MusicInfo info)
{ {
_logger.LogMusicInfoWithInformation(info); _logger.LogMusicInfoWithInformation(info);
try try
{ {
var album = await downloader.DownloadAsync(info.Name, info.Artist); var album = await downloader.DownloadAsync(info.Name, info.Artist);

View File

@@ -64,9 +64,14 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.NetEase
return new LyricItemCollection(LyricItemCollectionOption.NullInstance); return new LyricItemCollection(LyricItemCollectionOption.NullInstance);
} }
if (json.OriginalLyric.Text.Contains("纯音乐,请欣赏"))
{
return new LyricItemCollection(null);
}
return _lyricItemCollectionFactory.Build( return _lyricItemCollectionFactory.Build(
json.OriginalLyric.Text, json.OriginalLyric.Text,
json.TranslationLyric.Text); json.TranslationLyric?.Text);
} }
protected virtual void ValidateSongSearchResponse(SongSearchResponse response, LyricDownloaderArgs args) protected virtual void ValidateSongSearchResponse(SongSearchResponse response, LyricDownloaderArgs args)

View File

@@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.1.0" /> <PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.0" />
<PackageReference Include="McMaster.Extensions.Hosting.CommandLine" Version="3.1.0" /> <PackageReference Include="McMaster.Extensions.Hosting.CommandLine" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />

View File

@@ -34,5 +34,13 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyric
lyric.IsPruneMusic.ShouldBe(false); lyric.IsPruneMusic.ShouldBe(false);
lyric.ToString().Contains("惑う心繋ぎ止める").ShouldBeTrue(); 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);
}
} }
} }

View File

@@ -14,7 +14,7 @@ namespace ZonyLrcTools.Tests.Infrastructure.Tag
var tagLoader = ServiceProvider.GetRequiredService<ITagLoader>(); var tagLoader = ServiceProvider.GetRequiredService<ITagLoader>();
tagLoader.ShouldNotBeNull(); tagLoader.ShouldNotBeNull();
var info = await tagLoader.LoadTagAsync(/*Path.Combine(Directory.GetCurrentDirectory(), "MusicFiles", "曾经艺也 - 荀彧(纯音乐版).mp3")*/@"C:\Users\Zony\Downloads\GALA.-\GALA - 追梦赤子心.mp3"); var info = await tagLoader.LoadTagAsync(@"D:\はるまきごはん 煮ル果実 くらげP 蜂屋ななし じん かいりきベア - ダンスロボットダンス (アレンジメドレー (キメラver) はるまきごはん×煮ル果実×和田たけあき×栗山夕璃(蜂屋.flac");
info.ShouldNotBeNull(); info.ShouldNotBeNull();
info.Name.ShouldBe("荀彧(纯音乐版)"); info.Name.ShouldBe("荀彧(纯音乐版)");
info.Artist.ShouldBe("曾经艺也"); info.Artist.ShouldBe("曾经艺也");