Добавлен пункт "мои плейлисты"
This commit is contained in:
@@ -161,11 +161,56 @@ public class YandexMusicService
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<YandexSearchResult> SearchMyPlaylists(ApplicationUser user)
|
||||
{
|
||||
YandexSearchResult result = new();
|
||||
|
||||
await AuthorizeIfNot(user);
|
||||
|
||||
|
||||
var favoritesPlaylist = await Api.Playlist.FavoritesAsync();
|
||||
result.Playlists = favoritesPlaylist?.Select(t => new YandexPlaylist
|
||||
{
|
||||
Uuid = t.PlaylistUuid,
|
||||
Kind = t.Kind,
|
||||
OwnerUid = t.Owner?.Uid ?? string.Empty,
|
||||
Title = t.Title,
|
||||
Description = t.Description,
|
||||
CoverUrl = t.Cover.GetUrl(),
|
||||
TrackCount = t.TrackCount,
|
||||
}).ToList();
|
||||
|
||||
var personalPlaylists = await Api.Playlist.GetPersonalPlaylistsAsync();
|
||||
result.PersonalPlaylists = personalPlaylists?.Select(t => new YandexPlaylist
|
||||
{
|
||||
Uuid = t.PlaylistUuid,
|
||||
Kind = t.Kind,
|
||||
OwnerUid = t.Owner?.Uid ?? string.Empty,
|
||||
Title = t.Title,
|
||||
Description = t.Description,
|
||||
CoverUrl = t.Cover.GetUrl(),
|
||||
TrackCount = t.TrackCount,
|
||||
}).ToList();
|
||||
|
||||
var likedPlaylists = (await Api.Library.GetLikedPlaylistsAsync())?.Select(t => t.Playlist).ToList();
|
||||
result.LikedPlaylists = likedPlaylists?.Select(t => new YandexPlaylist
|
||||
{
|
||||
Uuid = t.PlaylistUuid,
|
||||
Kind = t.Kind,
|
||||
OwnerUid = t.Owner?.Uid ?? string.Empty,
|
||||
Title = t.Title,
|
||||
Description = t.Description,
|
||||
CoverUrl = t.Cover.GetUrl(),
|
||||
TrackCount = t.TrackCount,
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<YandexSearchResult> SearchTracksByIdAsync(
|
||||
ApplicationUser user,
|
||||
string id,
|
||||
TrackSearchType searchType,
|
||||
int limit = 20
|
||||
TrackSearchType searchType
|
||||
)
|
||||
{
|
||||
YandexSearchResult result = new();
|
||||
@@ -254,8 +299,8 @@ public class YandexMusicService
|
||||
TrackCount = p.TrackCount,
|
||||
}).ToList();
|
||||
|
||||
|
||||
result.Tracks = artist.PopularTracks.Select(t => new YandexTrack
|
||||
var allTraks = await artist.Artist.GetAllTracksAsync();
|
||||
result.Tracks = allTraks?.Select(t => new YandexTrack
|
||||
{
|
||||
TrackId = t.Id,
|
||||
Title = t.Title,
|
||||
|
||||
Reference in New Issue
Block a user