4 Commits

Author SHA1 Message Date
real-zony
6c25483f1e ci: Release new version。 2022-09-24 19:20:19 +08:00
real-zony
b64f83d56b fix: Removed NAudio related code. 2022-09-24 19:19:14 +08:00
real-zony
6ad154a62b feat: Add update check logic. 2022-09-24 19:13:57 +08:00
real-zony
32adab68b6 docs: Update README.md file.
Added start history section.
2022-09-23 10:44:05 +08:00
10 changed files with 152 additions and 53 deletions

View File

@@ -3,8 +3,8 @@ name: .NET
on:
push:
branches: [ dev ]
# paths:
# - "versions/**"
paths:
- "versions/**"
pull_request:
branches: [ dev ]

View File

@@ -57,6 +57,8 @@ macOS 和 Linux 用户请打开终端,切换到软件目录,一样执行命
程序的所有的配置信息,都在 `config.yaml` 进行更改,下面标注了各个配置的说明。
其中是否开启的可选项为 `true` 或者 `false`,等同于中文的是和否。
```yaml
globalOption:
# 允许扫描的歌曲文件后缀名。
@@ -95,18 +97,27 @@ globalOption:
plugin:
- name: NetEase # 基于网易云音乐的歌词下载器。
priority: 1 # 优先级,升序排列,改为 -1 时禁用。
depth: 30 # 搜索深度,值越大搜索结果越多,但搜索时间越长。
- name: QQ # 基于 QQ 音乐的歌词下载器。
priority: 2
# depth: 10 # 暂时不支持。
- name: KuGou # 基于酷狗音乐的歌词下载器。
priority: 3
depth: 10
# 歌词下载的一些共有配置参数。
config:
isOneLine: true # 双语歌词是否合并为一行展示。
lineBreak: "\n" # 换行符的类型,记得使用双引号指定。
isEnableTranslation: true # 是否启用翻译歌词。
isSkipExistLyricFiles: false # 如果歌词文件已经存在,是否跳过这些文件
isOneLine: true # 双语歌词是否合并为一行展示。
lineBreak: "\n" # 换行符的类型,记得使用双引号指定。
isEnableTranslation: true # 是否启用翻译歌词。
isOnlyOutputTranslation: false # 是否只输出翻译歌词
isSkipExistLyricFiles: false # 如果歌词文件已经存在,是否跳过这些文件。
fileEncoding: 'utf-8' # 歌词文件的编码格式。
```
#### 支持的编码格式
详细信息请参考: [MSDN Encoding 列表](https://learn.microsoft.com/en-us/dotnet/api/System.Text.Encoding.GetEncodings?view=net-6.0#examples),使用 `identifier and name` 作为参数值填入 `config.yaml` 文件当中的 `fileEncoding`
### 屏蔽字典
屏蔽字典适用于网易云音乐歌词下载,针对某些单词,网易云音乐使用了 * 号进行屏蔽,这个时候可以使用屏蔽字典,设置歌曲名的关键词替换。例如有一首歌曲叫做 *Fucking ABC* ,这个时候网易云实际的名字是 *Fu****ing* ,用户只需要在屏蔽字典加入替换逻辑即可,例如:
@@ -123,6 +134,10 @@ globalOption:
<img src="./docs/img/alipay.jpg" width="200"/><img src="./docs/img/wechat.jpg" width="200"/>
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=real-zony/ZonyLrcToolsX&type=Timeline)](https://star-history.com/#real-zony/ZonyLrcToolsX&Timeline)
## 路线图
- [x] 支持跨平台的 CLI 工具。

View File

@@ -8,7 +8,6 @@ using System.Threading.Tasks;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NAudio.Wave;
using ZonyLrcTools.Cli.Config;
using ZonyLrcTools.Cli.Infrastructure;
using ZonyLrcTools.Cli.Infrastructure.Album;
@@ -137,7 +136,7 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand
.ToList();
// Load music total time info.
result.Foreach(m => { m.TotalTime = (long?)new AudioFileReader(m.FilePath).TotalTime.TotalMilliseconds; });
// result.Foreach(m => { m.TotalTime = (long?)new AudioFileReader(m.FilePath).TotalTime.TotalMilliseconds; });
_logger.LogInformation($"已成功加载 {files.Count} 个音乐文件的标签信息。");

View File

@@ -0,0 +1,62 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using ZonyLrcTools.Cli.Infrastructure.DependencyInject;
using ZonyLrcTools.Cli.Infrastructure.Network;
using ZonyLrcTools.Cli.Infrastructure.Updater.JsonModel;
namespace ZonyLrcTools.Cli.Infrastructure.Updater;
public class DefaultUpdater : ISingletonDependency
{
public const string UpdateUrl = "https://api.zony.me/lrc-tools/update";
private readonly IWarpHttpClient _warpHttpClient;
private readonly ILogger<DefaultUpdater> _logger;
public DefaultUpdater(IWarpHttpClient warpHttpClient,
ILogger<DefaultUpdater> logger)
{
_warpHttpClient = warpHttpClient;
_logger = logger;
}
public async Task CheckUpdateAsync()
{
var response = await _warpHttpClient.GetAsync<NewVersionResponse>(UpdateUrl);
if (response == null)
{
return;
}
var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
if (response.NewVersion <= currentVersion)
{
return;
}
var importantItem = response.Items.FirstOrDefault(x => x.ItemType == NewVersionItemType.Important);
if (importantItem != null)
{
_logger.LogWarning($"发现了新版本,请点击下面的链接进行更新:{importantItem.Url}");
_logger.LogWarning($"最新版本号:{response.NewVersion},当前版本号: ${currentVersion}");
_logger.LogWarning($"更新内容:{response.NewVersionDescription}");
if (OperatingSystem.IsWindows())
{
Process.Start("explorer.exe", importantItem.Url);
}
else if (OperatingSystem.IsMacOS())
{
Process.Start("open", importantItem.Url);
}
else if (OperatingSystem.IsLinux())
{
Process.Start("xdg-open", importantItem.Url);
}
}
}
}

View File

@@ -0,0 +1,8 @@
namespace ZonyLrcTools.Cli.Infrastructure.Updater.JsonModel;
public class NewVersionItem
{
public string Url { get; set; }
public NewVersionItemType ItemType { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace ZonyLrcTools.Cli.Infrastructure.Updater.JsonModel;
public enum NewVersionItemType
{
Important,
NormalBinaryFile
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace ZonyLrcTools.Cli.Infrastructure.Updater.JsonModel;
public class NewVersionResponse
{
public Version NewVersion { get; set; }
public string NewVersionDescription { get; set; }
public List<NewVersionItem> Items { get; set; }
public DateTime UpdateTime { get; set; }
}

View File

@@ -3,41 +3,44 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<AssemblyVersion>0.0.0.1</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
<PackageVersion>0.0.0.1</PackageVersion>
<Version>0.0.0.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1" />
<PackageReference Include="McMaster.Extensions.Hosting.CommandLine" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="NAudio" Version="2.1.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Refit" Version="6.3.2" />
<PackageReference Include="Refit.HttpClientFactory" Version="6.3.2" />
<PackageReference Include="Refit.Newtonsoft.Json" Version="6.3.2" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1" />
<PackageReference Include="McMaster.Extensions.Hosting.CommandLine" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Refit" Version="6.3.2" />
<PackageReference Include="Refit.HttpClientFactory" Version="6.3.2" />
<PackageReference Include="Refit.Newtonsoft.Json" Version="6.3.2" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
</ItemGroup>
<ItemGroup>
<None Remove="appsettings.json" />
<None Remove="Resources\error_msg.json" />
<Content Include="Resources\error_msg.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Remove="BlockWords.json" />
<Content Include="BlockWords.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Remove="config.yaml" />
<Content Include="config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Remove="appsettings.json" />
<None Remove="Resources\error_msg.json" />
<Content Include="Resources\error_msg.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Remove="BlockWords.json" />
<Content Include="BlockWords.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Remove="config.yaml" />
<Content Include="config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -9,6 +9,7 @@ globalOption:
isEnable: false # 是否启用代理。
ip: 127.0.0.1 # 代理服务 IP 地址。
port: 4780 # 代理服务端口号。
updateUrl: https://api.zony.me/lrc-tools/update # 更新检查地址。
# 下载器的相关参数配置。
provider:

View File

@@ -1,16 +1,5 @@
New Features:
- [[#114](https://github.com/real-zony/ZonyLrcToolsX/issues/114)] 下载双语歌词的时候,可以控制是否仅输出翻译歌词。
- [[6d7ee04](https://github.com/real-zony/ZonyLrcToolsX/commit/6d7ee04b741191b5526075cdd3c3fc2c5737880f)] 提供深度搜索选项,以便更加准确地匹配歌曲歌词,值越大结果越准确,但是搜索速度越慢。
New Features: None
Breaking Changes: None
Enhancement:
- 关于网易云歌词下载器在搜索歌曲名带括号的歌曲时,会搜索不到的情况,现在默认会移除掉歌曲名中的括号进行搜索以增强准确性。
- [[#100](https://github.com/real-zony/ZonyLrcToolsX/issues/100)] 优化歌曲查找逻辑,优先匹配长度符合实际歌曲长度的歌词。
Enhancement: None
Fixed Bugs:
- [[#106](https://github.com/real-zony/ZonyLrcToolsX/issues/106)] 跳过已存在歌词的选项存在逻辑问题,会导致下载专辑图像的时候也会跳过带歌词的歌曲文件。
- [[85f325b](https://github.com/real-zony/ZonyLrcToolsX/commit/85f325b300dd4e6f54c783b2f9065ab4c566e3ad)] 修复某些极端情况下网易云歌词下载器报错的问题。
- [[#115](https://github.com/real-zony/ZonyLrcToolsX/issues/115)] NAudio 有问题,暂时屏蔽该功能。