mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-09-04 20:46:54 +00:00
feat: Added KuWo(酷我) Music lyrics source (incomplete).
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZonyLrcTools.Common.Lyrics;
|
||||
|
||||
namespace ZonyLrcTools.Tests.Infrastructure.Lyrics
|
||||
{
|
||||
public class KuGouLyricProviderTests : TestBase
|
||||
{
|
||||
private readonly ILyricsProvider _lyricsProvider;
|
||||
|
||||
public KuGouLyricProviderTests()
|
||||
{
|
||||
_lyricsProvider = GetService<IEnumerable<ILyricsProvider>>()
|
||||
.FirstOrDefault(t => t.DownloaderName == InternalLyricsProviderNames.KuGou);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("东方红", null);
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBe(false);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZonyLrcTools.Common.Lyrics;
|
||||
|
||||
namespace ZonyLrcTools.Tests.Infrastructure.Lyrics;
|
||||
|
||||
public class KuWoLyricsProviderTests : TestBase
|
||||
{
|
||||
private readonly ILyricsProvider _kuwoLyricsProvider;
|
||||
|
||||
public KuWoLyricsProviderTests()
|
||||
{
|
||||
_kuwoLyricsProvider = GetService<IEnumerable<ILyricsProvider>>()
|
||||
.FirstOrDefault(t => t.DownloaderName == InternalLyricsProviderNames.KuWo);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Test()
|
||||
{
|
||||
var lyric = await _kuwoLyricsProvider.DownloadAsync("告白气球", "周杰伦");
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBeFalse();
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZonyLrcTools.Common.Configuration;
|
||||
using ZonyLrcTools.Common.Lyrics;
|
||||
|
||||
namespace ZonyLrcTools.Tests.Infrastructure.Lyrics
|
||||
{
|
||||
public class LyricCollectionTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void LyricCollectionLineBreak_Test()
|
||||
{
|
||||
var lyricObject = new LyricsItemCollection(new GlobalLyricsConfigOptions
|
||||
{
|
||||
IsOneLine = false,
|
||||
LineBreak = LineBreakType.MacOs
|
||||
})
|
||||
{
|
||||
new(0, 20, "你好世界!"),
|
||||
new(0, 22, "Hello World!")
|
||||
};
|
||||
|
||||
lyricObject.ToString().ShouldContain(LineBreakType.MacOs);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,101 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZonyLrcTools.Common.Configuration;
|
||||
using ZonyLrcTools.Common.Lyrics;
|
||||
|
||||
namespace ZonyLrcTools.Tests.Infrastructure.Lyrics
|
||||
{
|
||||
public class NetEaseLyricsProviderTests : TestBase
|
||||
{
|
||||
private readonly ILyricsProvider _lyricsProvider;
|
||||
|
||||
public NetEaseLyricsProviderTests()
|
||||
{
|
||||
_lyricsProvider = GetService<IEnumerable<ILyricsProvider>>()
|
||||
.FirstOrDefault(t => t.DownloaderName == InternalLyricsProviderNames.NetEase);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("Hollow", "Janet Leon");
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBe(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Issue_75_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("Daybreak", "samfree,初音ミク");
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBe(false);
|
||||
lyric.ToString().Contains("惑う心繋ぎ止める").ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Issue_82_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("シンデレラ (Giga First Night Remix)", "DECO 27 ギガP");
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBe(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Issue84_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("太空彈", "01");
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBe(false);
|
||||
}
|
||||
|
||||
// About the new feature mentioned in issue #87.
|
||||
// Github Issue: https://github.com/real-zony/ZonyLrcToolsX/issues/87
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Issue85_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("Looking at Me", "Sabrina Carpenter");
|
||||
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBeFalse();
|
||||
lyric.ToString().ShouldContain("你看起来失了呼吸");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloaderAsync_Issue88_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("茫茫草原", "姚璎格");
|
||||
|
||||
lyric.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UnknownIssue_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("主題歌Arrietty's Song", "Cécile Corbel");
|
||||
|
||||
lyric.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloaderAsync_Issue101_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("君への嘘", "VALSHE");
|
||||
lyric.ShouldNotBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Issue114_Test()
|
||||
{
|
||||
var options = ServiceProvider.GetRequiredService<IOptions<GlobalOptions>>();
|
||||
options.Value.Provider.Lyric.Config.IsOnlyOutputTranslation = true;
|
||||
|
||||
var lyric = await _lyricsProvider.DownloadAsync("Bones", "Image Dragons");
|
||||
lyric.ToString().ShouldNotContain("Gimme, gimme, gimme some time to think");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZonyLrcTools.Common.Lyrics;
|
||||
|
||||
namespace ZonyLrcTools.Tests.Infrastructure.Lyrics
|
||||
{
|
||||
public class QQLyricsProviderTests : TestBase
|
||||
{
|
||||
private readonly ILyricsProvider _lyricsProvider;
|
||||
|
||||
public QQLyricsProviderTests()
|
||||
{
|
||||
_lyricsProvider = GetService<IEnumerable<ILyricsProvider>>()
|
||||
.FirstOrDefault(t => t.DownloaderName == InternalLyricsProviderNames.QQ);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("东风破", "周杰伦");
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBe(false);
|
||||
}
|
||||
|
||||
// About the new feature mentioned in issue #87.
|
||||
// Github Issue: https://github.com/real-zony/ZonyLrcToolsX/issues/87
|
||||
[Fact]
|
||||
public async Task DownloadAsync_Issue85_Test()
|
||||
{
|
||||
var lyric = await _lyricsProvider.DownloadAsync("Looking at Me", "Sabrina Carpenter");
|
||||
|
||||
lyric.ShouldNotBeNull();
|
||||
lyric.IsPruneMusic.ShouldBeFalse();
|
||||
lyric.ToString().ShouldContain("你好像快要不能呼吸");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user