Release 1.0.0.3: fix artist wrapper and lyrics fallback
This commit is contained in:
1 parent
16515c5166
commit
84e3ea34c8
10 files changed
+92
-13
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>1.0.0.2</Version>
|
||||
<AssemblyVersion>1.0.0.2</AssemblyVersion>
|
||||
<FileVersion>1.0.0.2</FileVersion>
|
||||
<Version>1.0.0.3</Version>
|
||||
<AssemblyVersion>1.0.0.3</AssemblyVersion>
|
||||
<FileVersion>1.0.0.3</FileVersion>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>Jellyfin.Plugin.YandexMusic</RootNamespace>
|
||||
<AssemblyName>Jellyfin.Plugin.YandexMusic</AssemblyName>
|
||||
|
||||
@@ -164,6 +164,13 @@ public class YandexMusicLyricProvider : ILyricProvider, IHasOrder
|
||||
}
|
||||
}
|
||||
|
||||
var supplement = await _client.GetSupplementLyricsAsync(trackId, cancellationToken).ConfigureAwait(false);
|
||||
if (!string.IsNullOrWhiteSpace(supplement))
|
||||
{
|
||||
Cache[trackId] = (supplement, "txt", DateTime.UtcNow);
|
||||
return (supplement, "txt");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -229,6 +229,22 @@ public sealed class ArtistLinkDto
|
||||
public string? SocialNetwork { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Response of /artists/{id}.</summary>
|
||||
public sealed class ArtistDetailResponse
|
||||
{
|
||||
[JsonPropertyName("artist")]
|
||||
public ArtistDto? Artist { get; set; }
|
||||
|
||||
[JsonPropertyName("albums")]
|
||||
public List<AlbumDto> Albums { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("similarArtists")]
|
||||
public List<ArtistDto> SimilarArtists { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("allCovers")]
|
||||
public List<CoverDto> AllCovers { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>Response of /artists/{id}/info.</summary>
|
||||
public sealed class ArtistInfoResponse
|
||||
{
|
||||
@@ -297,6 +313,30 @@ public sealed class GenreTitleDto
|
||||
public string? FullTitle { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Track supplement response.</summary>
|
||||
public sealed class SupplementResponse
|
||||
{
|
||||
[JsonPropertyName("result")]
|
||||
public SupplementDto? Result { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Track supplement payload.</summary>
|
||||
public sealed class SupplementDto
|
||||
{
|
||||
[JsonPropertyName("lyrics")]
|
||||
public SupplementLyricsDto? Lyrics { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Lyrics contained in a track supplement.</summary>
|
||||
public sealed class SupplementLyricsDto
|
||||
{
|
||||
[JsonPropertyName("lyrics")]
|
||||
public string? Lyrics { get; set; }
|
||||
|
||||
[JsonPropertyName("fullLyrics")]
|
||||
public string? FullLyrics { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Lyrics lookup response.</summary>
|
||||
public sealed class LyricsResponse
|
||||
{
|
||||
|
||||
@@ -154,11 +154,11 @@ public sealed class YandexMusicClient
|
||||
/// <summary>Gets an artist by id.</summary>
|
||||
public async Task<ArtistDto?> GetArtistAsync(long id, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await GetJsonAsync<YandexResponse<ArtistDto>>(
|
||||
var response = await GetJsonAsync<YandexResponse<ArtistDetailResponse>>(
|
||||
string.Format(CultureInfo.InvariantCulture, "/artists/{0}", id),
|
||||
false,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
return response?.Result;
|
||||
return response?.Result?.Artist;
|
||||
}
|
||||
|
||||
/// <summary>Gets the extended artist card (bio, covers, links).</summary>
|
||||
@@ -300,6 +300,31 @@ public sealed class YandexMusicClient
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets plain lyrics from the track supplement endpoint. Works even though the signed
|
||||
/// /lyrics endpoint currently rejects signatures with "Invalid Sign".
|
||||
/// </summary>
|
||||
public async Task<string?> GetSupplementLyricsAsync(long trackId, CancellationToken cancellationToken)
|
||||
{
|
||||
if (Token is null || !Config.EnableLyrics)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var response = await GetJsonAsync<SupplementResponse>(
|
||||
string.Format(CultureInfo.InvariantCulture, "/tracks/{0}/supplement", trackId),
|
||||
true,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var text = response?.Result?.Lyrics?.FullLyrics;
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
text = response?.Result?.Lyrics?.Lyrics;
|
||||
}
|
||||
|
||||
return string.IsNullOrWhiteSpace(text) ? null : text.TrimStart('\uFEFF', '\u200B', ' ', '\r', '\n');
|
||||
}
|
||||
|
||||
/// <summary>Downloads an image from an allowed Yandex host.</summary>
|
||||
public async Task<byte[]?> GetImageBytesAsync(string url, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: "Yandex Music"
|
||||
guid: "f3b9626b-da14-4cbf-8ad1-33b92cfa6656"
|
||||
version: "1.0.0.2"
|
||||
version: "1.0.0.3"
|
||||
targetAbi: "12.4.0.0"
|
||||
framework: "net10.0"
|
||||
overview: "Metadata for music from Yandex Music."
|
||||
@@ -13,4 +13,4 @@ owner: "kirill"
|
||||
artifacts:
|
||||
- "Jellyfin.Plugin.YandexMusic.dll"
|
||||
changelog: >
|
||||
Fix string track ids and improve matching for tracks without artist tags.
|
||||
Fix artist endpoint wrapper, add supplement lyrics fallback, fix string track ids.
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+5
-5
@@ -9,12 +9,12 @@
|
||||
"imageUrl": "",
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.0.0.2",
|
||||
"changelog": "Fix string track ids and improve matching for tracks without artist tags.",
|
||||
"version": "1.0.0.3",
|
||||
"changelog": "Fix artist endpoint wrapper, add supplement lyrics fallback, fix string track ids.",
|
||||
"targetAbi": "12.4.0.0",
|
||||
"sourceUrl": "https://git.midns.ru/1xDed/jellyfin-plugin-yandexmusic/raw/branch/main/dist/Jellyfin.Plugin.YandexMusic_1.0.0.2.zip",
|
||||
"checksum": "3e7621c9e4605ac37a9a8f53abec9524",
|
||||
"timestamp": "2026-11-27T16:05:02Z"
|
||||
"sourceUrl": "https://git.midns.ru/1xDed/jellyfin-plugin-yandexmusic/raw/branch/main/dist/Jellyfin.Plugin.YandexMusic_1.0.0.3.zip",
|
||||
"checksum": "6110b90d6e53189ab50a4b31c20ba148",
|
||||
"timestamp": "2026-11-27T16:17:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
VERSION="1.0.0.2"
|
||||
VERSION="1.0.0.3"
|
||||
NAME="Jellyfin.Plugin.YandexMusic"
|
||||
PUBLISH_DIR="publish"
|
||||
ARTIFACTS_DIR="${ARTIFACTS_DIR:-artifacts}"
|
||||
|
||||
@@ -107,3 +107,10 @@ if (File.Exists("/tmp/lib_simple2.json"))
|
||||
}
|
||||
Console.WriteLine($"pipeline: matched {ok}, misses {fail}, full-fetch failures {fullFail}");
|
||||
}
|
||||
|
||||
Console.WriteLine("== artist wrapper ==");
|
||||
var artistDetail = await client.GetArtistAsync(6504263, CancellationToken.None);
|
||||
Console.WriteLine(artistDetail is null ? "artist FAILED" : $"artist {artistDetail.Id} {artistDetail.Name} genres={string.Join(",", artistDetail.Genres)}");
|
||||
Console.WriteLine("== supplement lyrics ==");
|
||||
var supp = await client.GetSupplementLyricsAsync(108719814, CancellationToken.None);
|
||||
Console.WriteLine(supp is null ? "supplement FAILED" : $"supplement {supp.Length} chars");
|
||||
Reference in new issue
Block a user