mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-01 20:30:41 +00:00
feat: Completed KuWo lyric source.
This commit is contained in:
parent
5d1e90f638
commit
acb9142e5f
20
README.md
20
README.md
@ -24,7 +24,7 @@ macOS 和 Linux 用户请打开终端,切换到软件目录,一样执行命
|
||||
|
||||
### 子命令
|
||||
|
||||
#### 歌曲下载
|
||||
#### 歌词下载
|
||||
|
||||
子命令为 `download`,可用于下载歌词数据和专辑图像,支持多个下载器进行下载。
|
||||
|
||||
@ -39,6 +39,7 @@ macOS 和 Linux 用户请打开终端,切换到软件目录,一样执行命
|
||||
```shell
|
||||
# 下载歌词
|
||||
./ZonyLrcTools.Cli.exe download -d "C:\歌曲目录" -l -n 2
|
||||
|
||||
# 下载专辑封面
|
||||
./ZonyLrcTools.Cli.exe download -d "C:\歌曲目录" -a -n 2
|
||||
```
|
||||
@ -71,6 +72,7 @@ globalOption:
|
||||
isEnable: false # 是否启用代理。
|
||||
ip: 127.0.0.1 # 代理服务 IP 地址。
|
||||
port: 4780 # 代理服务端口号。
|
||||
updateUrl: https://api.myzony.com/lrc-tools/update # 更新检查地址。
|
||||
|
||||
# 下载器的相关参数配置。
|
||||
provider:
|
||||
@ -97,13 +99,16 @@ globalOption:
|
||||
plugin:
|
||||
- name: NetEase # 基于网易云音乐的歌词下载器。
|
||||
priority: 1 # 优先级,升序排列,改为 -1 时禁用。
|
||||
depth: 30 # 搜索深度,值越大搜索结果越多,但搜索时间越长。
|
||||
depth: 10 # 搜索深度,值越大搜索结果越多,但搜索时间越长。
|
||||
- name: QQ # 基于 QQ 音乐的歌词下载器。
|
||||
priority: 2
|
||||
# depth: 10 # 暂时不支持。
|
||||
- name: KuGou # 基于酷狗音乐的歌词下载器。
|
||||
priority: 3
|
||||
depth: 10
|
||||
- name: KuWo # 基于酷我音乐的歌词下载器。
|
||||
priority: 4
|
||||
depth: 10
|
||||
# 歌词下载的一些共有配置参数。
|
||||
config:
|
||||
isOneLine: true # 双语歌词是否合并为一行展示。
|
||||
@ -118,6 +123,15 @@ globalOption:
|
||||
|
||||
详细信息请参考: [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`。
|
||||
|
||||
#### 支持的歌词源
|
||||
|
||||
| 歌词源 | 默认优先级 |
|
||||
| ---------- | ---------- |
|
||||
| 网易云音乐 | 1 |
|
||||
| QQ 音乐 | 2 |
|
||||
| 酷狗音乐 | 3 |
|
||||
| 酷我音乐 | 4 |
|
||||
|
||||
### 屏蔽字典
|
||||
|
||||
屏蔽字典适用于网易云音乐歌词下载,针对某些单词,网易云音乐使用了 * 号进行屏蔽,这个时候可以使用屏蔽字典,设置歌曲名的关键词替换。例如有一首歌曲叫做 *Fucking ABC* ,这个时候网易云实际的名字是 *Fu****ing* ,用户只需要在屏蔽字典加入替换逻辑即可,例如:
|
||||
@ -141,5 +155,5 @@ globalOption:
|
||||
## 路线图
|
||||
|
||||
- [x] 支持跨平台的 CLI 工具。
|
||||
- [ ] 基于 Web GUI 的操作站点。
|
||||
- [x] 基于 Web GUI 的操作站点。
|
||||
- [ ] 支持插件系统(Lua 引擎)。
|
||||
|
@ -9,7 +9,7 @@ globalOption:
|
||||
isEnable: false # 是否启用代理。
|
||||
ip: 127.0.0.1 # 代理服务 IP 地址。
|
||||
port: 4780 # 代理服务端口号。
|
||||
updateUrl: https://api.zony.me/lrc-tools/update # 更新检查地址。
|
||||
updateUrl: https://api.myzony.com/lrc-tools/update # 更新检查地址。
|
||||
|
||||
# 下载器的相关参数配置。
|
||||
provider:
|
||||
|
@ -6,13 +6,18 @@ public class GetLyricsResponse
|
||||
{
|
||||
[JsonProperty("status")] public int Status { get; set; }
|
||||
|
||||
[JsonProperty("lrclist")] public ICollection<GetLyricsItem> Lyrics { get; set; }
|
||||
[JsonProperty("data")] public GetLyricsResponseInnerData Data { get; set; }
|
||||
|
||||
[JsonProperty("msg")] public string? ErrorMessage { get; set; }
|
||||
|
||||
[JsonProperty("msgs")] public string? ErrorMessage2 { get; set; }
|
||||
}
|
||||
|
||||
public class GetLyricsResponseInnerData
|
||||
{
|
||||
[JsonProperty("lrclist")] public ICollection<GetLyricsItem> Lyrics { get; set; }
|
||||
}
|
||||
|
||||
public class GetLyricsItem
|
||||
{
|
||||
[JsonProperty("lineLyric")] public string Text { get; set; }
|
||||
|
@ -55,16 +55,33 @@ public class KuWoLyricsProvider : LyricsProvider
|
||||
});
|
||||
}
|
||||
|
||||
protected override ValueTask<LyricsItemCollection> GenerateLyricAsync(object lyricsObject, LyricsProviderArgs args)
|
||||
protected override async ValueTask<LyricsItemCollection> GenerateLyricAsync(object lyricsObject, LyricsProviderArgs args)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
await ValueTask.CompletedTask;
|
||||
|
||||
var lyricsResponse = (GetLyricsResponse)lyricsObject;
|
||||
var items = lyricsResponse.Data.Lyrics.Select(l =>
|
||||
{
|
||||
var position = double.Parse(l.Position);
|
||||
var positionSpan = TimeSpan.FromSeconds(position);
|
||||
return new LyricsItem(positionSpan.Minutes, double.Parse($"{positionSpan.Seconds}.{positionSpan.Milliseconds}"), l.Text);
|
||||
});
|
||||
|
||||
var lyricsItemCollection = new LyricsItemCollection(_options.Provider.Lyric.Config);
|
||||
lyricsItemCollection.AddRange(items);
|
||||
return lyricsItemCollection;
|
||||
}
|
||||
|
||||
protected void ValidateSongSearchResponse(SongSearchResponse response, LyricsProviderArgs args)
|
||||
protected virtual void ValidateSongSearchResponse(SongSearchResponse response, LyricsProviderArgs args)
|
||||
{
|
||||
if (response.Code != 200)
|
||||
{
|
||||
throw new ErrorCodeException(ErrorCodes.TheReturnValueIsIllegal, response.ErrorMessage, args);
|
||||
}
|
||||
|
||||
if (response.InnerData.SongItems.Count == 0)
|
||||
{
|
||||
throw new ErrorCodeException(ErrorCodes.NoMatchingSong, attachObj: args);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user