7 Commits

Author SHA1 Message Date
real-zony
a39302dfb7 ci: Fix ci build issue.
Some checks failed
.NET / build-linux-windows (push) Has been cancelled
.NET / build-macos (push) Has been cancelled
.NET / release (push) Has been cancelled
2026-01-09 00:25:01 +08:00
real-zony
35b9c81ff2 chore: trigger build. 2026-01-09 00:15:43 +08:00
real-zony
62a71a574b ci: handle macOS code signing issues. 2026-01-09 00:13:55 +08:00
real-zony
7919147e4f build: Upgrade dotnet version to 10.0 and update the dependent package version. 2026-01-09 00:09:13 +08:00
real-zony
c89b79fda6 build: Upgraded package version. 2025-07-25 22:27:24 +08:00
real-zony
e08d1c7f16 ci: Publish new version.(4.0.2)
Some checks failed
.NET / build (push) Has been cancelled
.NET / release (push) Has been cancelled
2024-12-15 15:29:32 +08:00
real-zony
c3d98d60b5 fix: Fixed the garbled text issue caused by the CSV file encoding. (#156) 2024-12-15 15:20:33 +08:00
11 changed files with 133 additions and 61 deletions

View File

@@ -9,55 +9,101 @@ on:
branches: [ dev ] branches: [ dev ]
jobs: jobs:
build: # Windows 和 Linux 构建(保持在 Ubuntu 上)
build-linux-windows:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get build version - name: Get build version
id: date id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')${{github.run_number}}" run: echo "date=$(date +'%Y%m%d')${{github.run_number}}" >> $GITHUB_OUTPUT
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: 8.0.x dotnet-version: 10.0.x
- name: Restore dependencies - name: Publish Windows and Linux
run: dotnet restore
- name: Publish
working-directory: ./src/ZonyLrcTools.Cli working-directory: ./src/ZonyLrcTools.Cli
run: | run: |
ls -a for platform in win-x64 linux-x64 win-arm64 linux-arm64; do
chmod +x ./publish.sh dotnet publish -r "$platform" -c Release -p:PublishSingleFile=true -p:UseAppHost=true -p:DebugType=none --self-contained true
./publish.sh cd ./bin/Release/net10.0/"$platform"/publish/
mv ./TempFiles ../../ zip -r ./ZonyLrcTools_"$platform"_"${{ steps.date.outputs.date }}".zip ./
cd ../../../../../
mkdir -p ./TempFiles
mv ./bin/Release/net10.0/"$platform"/publish/*.zip ./TempFiles/
done
shell: bash shell: bash
env:
PUBLISH_VERSION: ${{ steps.date.outputs.date }}
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
retention-days: 90 retention-days: 90
name: release-files name: release-files-linux-windows
path: | path: ./src/ZonyLrcTools.Cli/TempFiles
./TempFiles
./versions/release.md
outputs: outputs:
version: ${{ steps.date.outputs.date }} version: ${{ steps.date.outputs.date }}
# macOS 构建(在 macOS runner 上,支持 ad-hoc 签名)
build-macos:
runs-on: macos-latest
steps:
- name: Get build version
id: date
run: echo "date=$(date +'%Y%m%d')${{github.run_number}}" >> $GITHUB_OUTPUT
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Publish macOS
working-directory: ./src/ZonyLrcTools.Cli
run: |
for platform in osx-x64 osx-arm64; do
dotnet publish -r "$platform" -c Release -p:PublishSingleFile=true -p:DebugType=none --self-contained true
# Ad-hoc 签名,解决 macOS Gatekeeper/XProtect 问题
codesign -s - --force --deep ./bin/Release/net10.0/"$platform"/publish/ZonyLrcTools.Cli
cd ./bin/Release/net10.0/"$platform"/publish/
zip -r ./ZonyLrcTools_"$platform"_"${{ steps.date.outputs.date }}".zip ./
cd ../../../../../
mkdir -p ./TempFiles
mv ./bin/Release/net10.0/"$platform"/publish/*.zip ./TempFiles/
done
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
retention-days: 90
name: release-files-macos
path: ./src/ZonyLrcTools.Cli/TempFiles
outputs:
version: ${{ steps.date.outputs.date }}
# Release Job - 合并所有平台的构建产物
release: release:
if: github.event_name == 'push' if: github.event_name == 'push'
needs: build needs: [build-linux-windows, build-macos]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download artifact - name: Checkout for release notes
uses: actions/download-artifact@v3 uses: actions/checkout@v4
- name: Download Linux/Windows artifacts
uses: actions/download-artifact@v4
with: with:
name: release-files name: release-files-linux-windows
path: . path: ./TempFiles
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
name: release-files-macos
path: ./TempFiles
- name: Upload Release - name: Upload Release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
artifacts: "./TempFiles/*.zip" artifacts: "./TempFiles/*.zip"
token: ${{ secrets.GITHUBACTIONS }} token: ${{ secrets.GITHUBACTIONS }}
tag: ZonyLrcToolsX_Alpha.${{ needs.build.outputs.version }} tag: ZonyLrcToolsX_Alpha.${{ needs.build-linux-windows.outputs.version }}
commit: dev commit: dev
bodyFile: ./versions/release.md bodyFile: ./versions/release.md

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>4.0.1</Version> <Version>4.0.3</Version>
<Authors>Zony(real-zony)</Authors> <Authors>Zony(real-zony)</Authors>
<RepositoryUrl>https://github.com/real-zony/ZonyLrcToolsX</RepositoryUrl> <RepositoryUrl>https://github.com/real-zony/ZonyLrcToolsX</RepositoryUrl>
</PropertyGroup> </PropertyGroup>

View File

@@ -6,20 +6,20 @@
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" /> <PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageVersion Include="McMaster.Extensions.Hosting.CommandLine" Version="4.1.1" /> <PackageVersion Include="McMaster.Extensions.Hosting.CommandLine" Version="4.1.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
<PackageVersion Include="QRCoder" Version="1.6.0" /> <PackageVersion Include="QRCoder" Version="1.7.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="8.0.0" /> <PackageVersion Include="Serilog.Extensions.Hosting" Version="10.0.0" />
<PackageVersion Include="Serilog.Sinks.Async" Version="2.1.0" /> <PackageVersion Include="Serilog.Sinks.Async" Version="2.1.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" /> <PackageVersion Include="Serilog.Sinks.Console" Version="6.1.1" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" /> <PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" /> <PackageVersion Include="System.Text.Encoding.CodePages" Version="10.0.1" />
<PackageVersion Include="Polly" Version="8.5.0" /> <PackageVersion Include="Polly" Version="8.6.5" />
<PackageVersion Include="TagLibSharp" Version="2.3.0" /> <PackageVersion Include="TagLibSharp" Version="2.3.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="NetEscapades.Configuration.Yaml" Version="3.1.0" /> <PackageVersion Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<PackageVersion Include="MusicDecrypto.Library" Version="2.4.1" /> <PackageVersion Include="MusicDecrypto.Library" Version="2.4.1" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.1" />
<PackageVersion Include="AutoMapper" Version="13.0.1" /> <PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" /> <PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.6" /> <PackageVersion Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.6" />
@@ -27,24 +27,19 @@
<PackageVersion Include="SuperSocket.WebSocket" Version="2.0.0-beta.11" /> <PackageVersion Include="SuperSocket.WebSocket" Version="2.0.0-beta.11" />
<PackageVersion Include="SuperSocket.WebSocket.Server" Version="2.0.0-beta.11" /> <PackageVersion Include="SuperSocket.WebSocket.Server" Version="2.0.0-beta.11" />
<!-- Testing Projects --> <!-- Testing Projects -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Shouldly" Version="4.2.1" /> <PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="xunit" Version="2.8.1" /> <PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1"> <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion> </PackageVersion>
<PackageVersion Include="coverlet.collector" Version="6.0.2"> <PackageVersion Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion> </PackageVersion>
<!-- Avalonia --> <!-- Avalonia -->
<PackageVersion Include="Avalonia" Version="11.0.11" /> <PackageVersion Include="Ude.NetStandard" Version="1.2.0" />
<PackageVersion Include="Avalonia.Desktop" Version="11.0.11" /> <PackageVersion Include="YamlDotNet" Version="16.3.0" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.11" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.0.11" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.0.11" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.11" />
<PackageVersion Include="YamlDotNet" Version="16.2.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
</PropertyGroup> </PropertyGroup>
@@ -14,6 +14,7 @@
<PackageReference Include="Serilog.Sinks.Console"/> <PackageReference Include="Serilog.Sinks.Console"/>
<PackageReference Include="Serilog.Sinks.File"/> <PackageReference Include="Serilog.Sinks.File"/>
<PackageReference Include="System.Text.Encoding.CodePages"/> <PackageReference Include="System.Text.Encoding.CodePages"/>
<PackageReference Include="Ude.NetStandard"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -12,9 +12,9 @@ for platform in "${Platforms[@]}"
do do
dotnet publish -r "$platform" -c Release -p:PublishSingleFile=true -p:DebugType=none --self-contained true || exit 1 dotnet publish -r "$platform" -c Release -p:PublishSingleFile=true -p:DebugType=none --self-contained true || exit 1
cd ./bin/Release/net8.0/"$platform"/publish/ || exit 1 cd ./bin/Release/net10.0/"$platform"/publish/ || exit 1
zip -r ./ZonyLrcTools_"$platform"_"${PUBLISH_VERSION}".zip ./ || exit 1 zip -r ./ZonyLrcTools_"$platform"_"${PUBLISH_VERSION}".zip ./ || exit 1
cd ../../../../../ || exit 1 cd ../../../../../ || exit 1
mv ./bin/Release/net8.0/"$platform"/publish/ZonyLrcTools_"$platform"_"$PUBLISH_VERSION".zip ./TempFiles mv ./bin/Release/net10.0/"$platform"/publish/ZonyLrcTools_"$platform"_"$PUBLISH_VERSION".zip ./TempFiles
done done

View File

@@ -1,3 +1,5 @@
using System.Text;
using Ude;
using ZonyLrcTools.Common.Infrastructure.DependencyInject; using ZonyLrcTools.Common.Infrastructure.DependencyInject;
namespace ZonyLrcTools.Common.MusicScanner; namespace ZonyLrcTools.Common.MusicScanner;
@@ -13,11 +15,15 @@ public class CsvFileMusicScanner : ITransientDependency
/// <param name="csvFilePath">CSV 文件的路径。</param> /// <param name="csvFilePath">CSV 文件的路径。</param>
/// <param name="outputDirectory">歌词文件的输出目录。</param> /// <param name="outputDirectory">歌词文件的输出目录。</param>
/// <param name="pattern">输出的歌词文件格式,默认是 "{Artist} - {Title}.lrc" 的形式。</param> /// <param name="pattern">输出的歌词文件格式,默认是 "{Artist} - {Title}.lrc" 的形式。</param>
public async Task<List<MusicInfo>> GetMusicInfoFromCsvFileAsync(string csvFilePath, string outputDirectory, string pattern) public async Task<List<MusicInfo>> GetMusicInfoFromCsvFileAsync(string csvFilePath, string outputDirectory,
string pattern)
{ {
var csvFileContent = await File.ReadAllTextAsync(csvFilePath); var encoding = DetectFileEncoding(csvFilePath);
var csvFileLines = csvFileContent.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
return csvFileLines.Skip(1).Select(line => GetMusicInfoFromCsvFileLine(line, outputDirectory, pattern)).ToList(); var csvFileContent = await File.ReadAllTextAsync(csvFilePath, encoding);
var csvFileLines = csvFileContent.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
return csvFileLines.Skip(1).Select(line => GetMusicInfoFromCsvFileLine(line, outputDirectory, pattern))
.ToList();
} }
private MusicInfo GetMusicInfoFromCsvFileLine(string csvFileLine, string outputDirectory, string pattern) private MusicInfo GetMusicInfoFromCsvFileLine(string csvFileLine, string outputDirectory, string pattern)
@@ -29,4 +35,19 @@ public class CsvFileMusicScanner : ITransientDependency
var musicInfo = new MusicInfo(fakeFilePath, name, artist); var musicInfo = new MusicInfo(fakeFilePath, name, artist);
return musicInfo; return musicInfo;
} }
private Encoding DetectFileEncoding(string filePath)
{
using var fileStream = File.OpenRead(filePath);
var detector = new CharsetDetector();
detector.Feed(fileStream);
detector.DataEnd();
if (detector.Charset != null)
{
return Encoding.GetEncoding(detector.Charset);
}
return Encoding.Default;
}
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
@@ -15,6 +15,7 @@
<PackageReference Include="Polly"/> <PackageReference Include="Polly"/>
<PackageReference Include="QRCoder"/> <PackageReference Include="QRCoder"/>
<PackageReference Include="TagLibSharp"/> <PackageReference Include="TagLibSharp"/>
<PackageReference Include="Ude.NetStandard" />
<PackageReference Include="YamlDotNet" /> <PackageReference Include="YamlDotNet" />
</ItemGroup> </ItemGroup>

View File

@@ -17,7 +17,7 @@ public class KuWoLyricsProviderTests : TestBase
.FirstOrDefault(t => t.DownloaderName == InternalLyricsProviderNames.KuWo); .FirstOrDefault(t => t.DownloaderName == InternalLyricsProviderNames.KuWo);
} }
[Fact] [Fact(Skip = "酷我音乐的 API 不稳定,可能导致测试失败,暂跳过")]
[Trait("LyricsProvider ", "KuGou")] [Trait("LyricsProvider ", "KuGou")]
public async Task DownloadAsync_Test() public async Task DownloadAsync_Test()
{ {

View File

@@ -116,7 +116,8 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyrics
[Fact] [Fact]
public async Task DownloadAsync_Source_Null_Test() public async Task DownloadAsync_Source_Null_Test()
{ {
var lyric = await _lyricsProvider.DownloadAsync("Concerto for Piano and Orchestra No. 12 in A major, K414 - 1. Allegro", var lyric = await _lyricsProvider.DownloadAsync(
"Concerto for Piano and Orchestra No. 12 in A major, K414 - 1. Allegro",
"Wolfgang Amadeus Mozart"); "Wolfgang Amadeus Mozart");
lyric.IsPruneMusic.ShouldBeTrue(); lyric.IsPruneMusic.ShouldBeTrue();
@@ -143,5 +144,12 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyrics
var lyric = await _lyricsProvider.DownloadAsync("Your Heart Is A Muscle (2012)", "Carly Rae Jepsen"); var lyric = await _lyricsProvider.DownloadAsync("Your Heart Is A Muscle (2012)", "Carly Rae Jepsen");
lyric.IsPruneMusic.ShouldBeFalse(); lyric.IsPruneMusic.ShouldBeFalse();
} }
[Fact]
public async Task DownloadAsync_Issue_156_Test()
{
var lyric = await _lyricsProvider.DownloadAsync("你说demo", "枯木逢春");
lyric.IsPruneMusic.ShouldBeFalse();
}
} }
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

View File

@@ -4,4 +4,4 @@ Enhancement: None
Fixed Bugs: Fixed Bugs:
- 修复了 #159/#155问题。 - [#167] Handle macOS code signing issues. (处理 macOS 代码签名问题。)