Yandex Music metadata plugin for Jellyfin 12.4
This commit is contained in:
commit
c3dc901337
25 files changed
+3233
No files matched your search
@@ -0,0 +1,357 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Jellyfin.Plugin.YandexMusic.Yandex;
|
||||
|
||||
/// <summary>Generic Yandex API envelope.</summary>
|
||||
public sealed class YandexResponse<T>
|
||||
{
|
||||
[JsonPropertyName("result")]
|
||||
public T? Result { get; set; }
|
||||
|
||||
[JsonPropertyName("error")]
|
||||
public YandexError? Error { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Yandex API error.</summary>
|
||||
public sealed class YandexError
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[JsonPropertyName("message")]
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Search response.</summary>
|
||||
public sealed class SearchResponse
|
||||
{
|
||||
[JsonPropertyName("result")]
|
||||
public SearchResult? Result { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Search result container.</summary>
|
||||
public sealed class SearchResult
|
||||
{
|
||||
[JsonPropertyName("tracks")]
|
||||
public SearchPage<TrackDto>? Tracks { get; set; }
|
||||
|
||||
[JsonPropertyName("albums")]
|
||||
public SearchPage<AlbumDto>? Albums { get; set; }
|
||||
|
||||
[JsonPropertyName("artists")]
|
||||
public SearchPage<ArtistDto>? Artists { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>A page of search results.</summary>
|
||||
public sealed class SearchPage<T>
|
||||
{
|
||||
[JsonPropertyName("results")]
|
||||
public List<T> Results { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("total")]
|
||||
public int Total { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Cover object.</summary>
|
||||
public sealed class CoverDto
|
||||
{
|
||||
[JsonPropertyName("uri")]
|
||||
public string? Uri { get; set; }
|
||||
|
||||
[JsonPropertyName("color")]
|
||||
public string? Color { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Track.</summary>
|
||||
public sealed class TrackDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("realId")]
|
||||
public string? RealId { get; set; }
|
||||
|
||||
[JsonPropertyName("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonPropertyName("durationMs")]
|
||||
public long? DurationMs { get; set; }
|
||||
|
||||
[JsonPropertyName("coverUri")]
|
||||
public string? CoverUri { get; set; }
|
||||
|
||||
[JsonPropertyName("ogImage")]
|
||||
public string? OgImage { get; set; }
|
||||
|
||||
[JsonPropertyName("explicit")]
|
||||
public bool Explicit { get; set; }
|
||||
|
||||
[JsonPropertyName("lyricsAvailable")]
|
||||
public bool LyricsAvailable { get; set; }
|
||||
|
||||
[JsonPropertyName("lyricsInfo")]
|
||||
public LyricsInfoDto? LyricsInfo { get; set; }
|
||||
|
||||
[JsonPropertyName("artists")]
|
||||
public List<ArtistDto> Artists { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("albums")]
|
||||
public List<AlbumDto> Albums { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("major")]
|
||||
public LabelDto? Major { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Lyrics availability info.</summary>
|
||||
public sealed class LyricsInfoDto
|
||||
{
|
||||
[JsonPropertyName("hasLyrics")]
|
||||
public bool HasLyrics { get; set; }
|
||||
|
||||
[JsonPropertyName("hasAvailableSyncLyrics")]
|
||||
public bool HasAvailableSyncLyrics { get; set; }
|
||||
|
||||
[JsonPropertyName("hasAvailableTextLyrics")]
|
||||
public bool HasAvailableTextLyrics { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Album or label reference.</summary>
|
||||
public sealed class AlbumDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonPropertyName("year")]
|
||||
public int? Year { get; set; }
|
||||
|
||||
[JsonPropertyName("releaseDate")]
|
||||
public string? ReleaseDate { get; set; }
|
||||
|
||||
[JsonPropertyName("genre")]
|
||||
public string? Genre { get; set; }
|
||||
|
||||
[JsonPropertyName("metaType")]
|
||||
public string? MetaType { get; set; }
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonPropertyName("coverUri")]
|
||||
public string? CoverUri { get; set; }
|
||||
|
||||
[JsonPropertyName("ogImage")]
|
||||
public string? OgImage { get; set; }
|
||||
|
||||
[JsonPropertyName("trackCount")]
|
||||
public int? TrackCount { get; set; }
|
||||
|
||||
[JsonPropertyName("artists")]
|
||||
public List<ArtistDto> Artists { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("labels")]
|
||||
[JsonConverter(typeof(LabelListConverter))]
|
||||
public List<LabelDto> Labels { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("volumes")]
|
||||
public List<List<long>> Volumes { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("explicit")]
|
||||
public bool? Explicit { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Label.</summary>
|
||||
public sealed class LabelDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Artist.</summary>
|
||||
public sealed class ArtistDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
[JsonConverter(typeof(FlexibleLongConverter))]
|
||||
public long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[JsonPropertyName("cover")]
|
||||
public CoverDto? Cover { get; set; }
|
||||
|
||||
[JsonPropertyName("ogImage")]
|
||||
public string? OgImage { get; set; }
|
||||
|
||||
[JsonPropertyName("genres")]
|
||||
public List<string> Genres { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[JsonPropertyName("counts")]
|
||||
public ArtistCountsDto? Counts { get; set; }
|
||||
|
||||
[JsonPropertyName("links")]
|
||||
public List<ArtistLinkDto> Links { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>Artist counters.</summary>
|
||||
public sealed class ArtistCountsDto
|
||||
{
|
||||
[JsonPropertyName("tracks")]
|
||||
public int Tracks { get; set; }
|
||||
|
||||
[JsonPropertyName("directAlbums")]
|
||||
public int DirectAlbums { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Artist link.</summary>
|
||||
public sealed class ArtistLinkDto
|
||||
{
|
||||
[JsonPropertyName("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonPropertyName("href")]
|
||||
public string? Href { get; set; }
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonPropertyName("socialNetwork")]
|
||||
public string? SocialNetwork { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Response of /artists/{id}/info.</summary>
|
||||
public sealed class ArtistInfoResponse
|
||||
{
|
||||
[JsonPropertyName("artist")]
|
||||
public ArtistDto? Artist { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[JsonPropertyName("covers")]
|
||||
public List<CoverDto> Covers { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("links")]
|
||||
public List<ArtistLinkDto> Links { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("likesCount")]
|
||||
public long? LikesCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Response of /artists/{id}/brief-info.</summary>
|
||||
public sealed class ArtistBriefResponse
|
||||
{
|
||||
[JsonPropertyName("result")]
|
||||
public ArtistBriefDto? Result { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Brief artist info.</summary>
|
||||
public sealed class ArtistBriefDto
|
||||
{
|
||||
[JsonPropertyName("artist")]
|
||||
public ArtistDto? Artist { get; set; }
|
||||
|
||||
[JsonPropertyName("similarArtists")]
|
||||
public List<ArtistDto> SimilarArtists { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("allCovers")]
|
||||
public List<CoverDto> AllCovers { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("albums")]
|
||||
public List<AlbumDto> Albums { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>Genre tree node.</summary>
|
||||
public sealed class GenreDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[JsonPropertyName("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonPropertyName("titles")]
|
||||
public Dictionary<string, GenreTitleDto> Titles { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("subGenres")]
|
||||
public List<GenreDto> SubGenres { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>Localized genre title.</summary>
|
||||
public sealed class GenreTitleDto
|
||||
{
|
||||
[JsonPropertyName("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonPropertyName("fullTitle")]
|
||||
public string? FullTitle { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Lyrics lookup response.</summary>
|
||||
public sealed class LyricsResponse
|
||||
{
|
||||
[JsonPropertyName("result")]
|
||||
public LyricsResultDto? Result { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Lyrics download info.</summary>
|
||||
public sealed class LyricsResultDto
|
||||
{
|
||||
[JsonPropertyName("downloadUrl")]
|
||||
public string? DownloadUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("writers")]
|
||||
public List<string> Writers { get; set; } = [];
|
||||
|
||||
[JsonPropertyName("lyricId")]
|
||||
public long? LyricId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>OAuth device code response.</summary>
|
||||
public sealed class DeviceCodeResponse
|
||||
{
|
||||
[JsonPropertyName("device_code")]
|
||||
public string DeviceCode { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("user_code")]
|
||||
public string UserCode { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("verification_url")]
|
||||
public string VerificationUrl { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("expires_in")]
|
||||
public int ExpiresIn { get; set; }
|
||||
|
||||
[JsonPropertyName("interval")]
|
||||
public int Interval { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>OAuth token response.</summary>
|
||||
public sealed class OAuthTokenResponse
|
||||
{
|
||||
[JsonPropertyName("access_token")]
|
||||
public string? AccessToken { get; set; }
|
||||
|
||||
[JsonPropertyName("refresh_token")]
|
||||
public string? RefreshToken { get; set; }
|
||||
|
||||
[JsonPropertyName("expires_in")]
|
||||
public int? ExpiresIn { get; set; }
|
||||
|
||||
[JsonPropertyName("token_type")]
|
||||
public string? TokenType { get; set; }
|
||||
|
||||
[JsonPropertyName("error")]
|
||||
public string? Error { get; set; }
|
||||
|
||||
[JsonPropertyName("error_description")]
|
||||
public string? ErrorDescription { get; set; }
|
||||
}
|
||||
Reference in new issue
Block a user