diff --git a/Jellyfin.Plugin.YandexMusic/Jellyfin.Plugin.YandexMusic.csproj b/Jellyfin.Plugin.YandexMusic/Jellyfin.Plugin.YandexMusic.csproj index dd6f657..3b4937a 100644 --- a/Jellyfin.Plugin.YandexMusic/Jellyfin.Plugin.YandexMusic.csproj +++ b/Jellyfin.Plugin.YandexMusic/Jellyfin.Plugin.YandexMusic.csproj @@ -1,9 +1,9 @@ - 1.0.0.2 - 1.0.0.2 - 1.0.0.2 + 1.0.0.3 + 1.0.0.3 + 1.0.0.3 net10.0 Jellyfin.Plugin.YandexMusic Jellyfin.Plugin.YandexMusic diff --git a/Jellyfin.Plugin.YandexMusic/Providers/YandexMusicLyricProvider.cs b/Jellyfin.Plugin.YandexMusic/Providers/YandexMusicLyricProvider.cs index 40dfc41..c862666 100644 --- a/Jellyfin.Plugin.YandexMusic/Providers/YandexMusicLyricProvider.cs +++ b/Jellyfin.Plugin.YandexMusic/Providers/YandexMusicLyricProvider.cs @@ -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; } } diff --git a/Jellyfin.Plugin.YandexMusic/Yandex/YandexModels.cs b/Jellyfin.Plugin.YandexMusic/Yandex/YandexModels.cs index bccf6d8..3b797c3 100644 --- a/Jellyfin.Plugin.YandexMusic/Yandex/YandexModels.cs +++ b/Jellyfin.Plugin.YandexMusic/Yandex/YandexModels.cs @@ -229,6 +229,22 @@ public sealed class ArtistLinkDto public string? SocialNetwork { get; set; } } +/// Response of /artists/{id}. +public sealed class ArtistDetailResponse +{ + [JsonPropertyName("artist")] + public ArtistDto? Artist { get; set; } + + [JsonPropertyName("albums")] + public List Albums { get; set; } = []; + + [JsonPropertyName("similarArtists")] + public List SimilarArtists { get; set; } = []; + + [JsonPropertyName("allCovers")] + public List AllCovers { get; set; } = []; +} + /// Response of /artists/{id}/info. public sealed class ArtistInfoResponse { @@ -297,6 +313,30 @@ public sealed class GenreTitleDto public string? FullTitle { get; set; } } +/// Track supplement response. +public sealed class SupplementResponse +{ + [JsonPropertyName("result")] + public SupplementDto? Result { get; set; } +} + +/// Track supplement payload. +public sealed class SupplementDto +{ + [JsonPropertyName("lyrics")] + public SupplementLyricsDto? Lyrics { get; set; } +} + +/// Lyrics contained in a track supplement. +public sealed class SupplementLyricsDto +{ + [JsonPropertyName("lyrics")] + public string? Lyrics { get; set; } + + [JsonPropertyName("fullLyrics")] + public string? FullLyrics { get; set; } +} + /// Lyrics lookup response. public sealed class LyricsResponse { diff --git a/Jellyfin.Plugin.YandexMusic/Yandex/YandexMusicClient.cs b/Jellyfin.Plugin.YandexMusic/Yandex/YandexMusicClient.cs index b8042ce..31664da 100644 --- a/Jellyfin.Plugin.YandexMusic/Yandex/YandexMusicClient.cs +++ b/Jellyfin.Plugin.YandexMusic/Yandex/YandexMusicClient.cs @@ -154,11 +154,11 @@ public sealed class YandexMusicClient /// Gets an artist by id. public async Task GetArtistAsync(long id, CancellationToken cancellationToken) { - var response = await GetJsonAsync>( + var response = await GetJsonAsync>( string.Format(CultureInfo.InvariantCulture, "/artists/{0}", id), false, cancellationToken).ConfigureAwait(false); - return response?.Result; + return response?.Result?.Artist; } /// Gets the extended artist card (bio, covers, links). @@ -300,6 +300,31 @@ public sealed class YandexMusicClient } } + /// + /// Gets plain lyrics from the track supplement endpoint. Works even though the signed + /// /lyrics endpoint currently rejects signatures with "Invalid Sign". + /// + public async Task GetSupplementLyricsAsync(long trackId, CancellationToken cancellationToken) + { + if (Token is null || !Config.EnableLyrics) + { + return null; + } + + var response = await GetJsonAsync( + 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'); + } + /// Downloads an image from an allowed Yandex host. public async Task GetImageBytesAsync(string url, CancellationToken cancellationToken) { diff --git a/build.yaml b/build.yaml index d6f8a79..38c887a 100644 --- a/build.yaml +++ b/build.yaml @@ -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. diff --git a/dist/Jellyfin.Plugin.YandexMusic_1.0.0.2.zip b/dist/Jellyfin.Plugin.YandexMusic_1.0.0.2.zip deleted file mode 100644 index 0597080..0000000 Binary files a/dist/Jellyfin.Plugin.YandexMusic_1.0.0.2.zip and /dev/null differ diff --git a/dist/Jellyfin.Plugin.YandexMusic_1.0.0.3.zip b/dist/Jellyfin.Plugin.YandexMusic_1.0.0.3.zip new file mode 100644 index 0000000..302a395 Binary files /dev/null and b/dist/Jellyfin.Plugin.YandexMusic_1.0.0.3.zip differ diff --git a/dist/manifest.json b/dist/manifest.json index f6a0943..f30c729 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -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" } ] } diff --git a/scripts/package.sh b/scripts/package.sh index 6970618..3dbba4f 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -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}" diff --git a/tests/YandexSmoke/Program.cs b/tests/YandexSmoke/Program.cs index 888c7dc..1d2424d 100644 --- a/tests/YandexSmoke/Program.cs +++ b/tests/YandexSmoke/Program.cs @@ -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");