Обнновлено до .net10
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
using YandexMusic.API.Models.Album;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для альбома
|
||||
/// </summary>
|
||||
public static partial class YAlbumExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для альбома
|
||||
/// </summary>
|
||||
public static partial class YAlbumExtensions
|
||||
public static YAlbum WithTracks(this YAlbum album)
|
||||
{
|
||||
public static YAlbum WithTracks(this YAlbum album)
|
||||
{
|
||||
return WithTracksAsync(album).GetAwaiter().GetResult();
|
||||
}
|
||||
return WithTracksAsync(album).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string AddLike(this YAlbum album)
|
||||
{
|
||||
return AddLikeAsync(album).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string AddLike(this YAlbum album)
|
||||
{
|
||||
return AddLikeAsync(album).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string RemoveLike(this YAlbum album)
|
||||
{
|
||||
return RemoveLikeAsync(album).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string RemoveLike(this YAlbum album)
|
||||
{
|
||||
return RemoveLikeAsync(album).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
using YandexMusic.API.Models.Album;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для альбома
|
||||
/// </summary>
|
||||
public static partial class YAlbumExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для альбома
|
||||
/// </summary>
|
||||
public static partial class YAlbumExtensions
|
||||
public static async Task<YAlbum> WithTracksAsync(this YAlbum album)
|
||||
{
|
||||
public static async Task<YAlbum> WithTracksAsync(this YAlbum album)
|
||||
{
|
||||
return album.Volumes != null
|
||||
? album
|
||||
: (await album.Context.API.Album.GetAsync(album.Context.Storage, album.Id))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<string> AddLikeAsync(this YAlbum album)
|
||||
{
|
||||
return (await album.Context.API.Library.AddAlbumLikeAsync(album.Context.Storage, album))
|
||||
return album.Volumes != null
|
||||
? album
|
||||
: (await album.Context.API.Album.GetAsync(album.Context.Storage, album.Id))
|
||||
.Result;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> RemoveLikeAsync(this YAlbum album)
|
||||
{
|
||||
return (await album.Context.API.Library.RemoveAlbumLikeAsync(album.Context.Storage, album))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<string> AddLikeAsync(this YAlbum album)
|
||||
{
|
||||
return (await album.Context.API.Library.AddAlbumLikeAsync(album.Context.Storage, album))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<string> RemoveLikeAsync(this YAlbum album)
|
||||
{
|
||||
return (await album.Context.API.Library.RemoveAlbumLikeAsync(album.Context.Storage, album))
|
||||
.Result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
using YandexMusic.API.Models.Artist;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для исполнителя
|
||||
/// </summary>
|
||||
public static partial class YArtistExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для исполнителя
|
||||
/// </summary>
|
||||
public static partial class YArtistExtensions
|
||||
public static YArtistBriefInfo BriefInfo(this YArtist artist)
|
||||
{
|
||||
public static YArtistBriefInfo BriefInfo(this YArtist artist)
|
||||
{
|
||||
return BriefInfoAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
return BriefInfoAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static YTracksPage GetTracks(this YArtist artist, int page = 0, int pageSize = 20)
|
||||
{
|
||||
return GetTracksAsync(artist, page, pageSize).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YTracksPage GetTracks(this YArtist artist, int page = 0, int pageSize = 20)
|
||||
{
|
||||
return GetTracksAsync(artist, page, pageSize).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static List<YTrack> GetAllTracks(this YArtist artist)
|
||||
{
|
||||
return GetAllTracksAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static List<YTrack> GetAllTracks(this YArtist artist)
|
||||
{
|
||||
return GetAllTracksAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string AddLike(this YArtist artist)
|
||||
{
|
||||
return AddLikeAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string AddLike(this YArtist artist)
|
||||
{
|
||||
return AddLikeAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string RemoveLike(this YArtist artist)
|
||||
{
|
||||
return RemoveLikeAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string RemoveLike(this YArtist artist)
|
||||
{
|
||||
return RemoveLikeAsync(artist).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,40 @@
|
||||
using YandexMusic.API.Models.Artist;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для исполнителя
|
||||
/// </summary>
|
||||
public static partial class YArtistExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для исполнителя
|
||||
/// </summary>
|
||||
public static partial class YArtistExtensions
|
||||
public static async Task<YArtistBriefInfo> BriefInfoAsync(this YArtist artist)
|
||||
{
|
||||
public static async Task<YArtistBriefInfo> BriefInfoAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Artist.GetAsync(artist.Context.Storage, artist.Id))
|
||||
.Result;
|
||||
}
|
||||
return (await artist.Context.API.Artist.GetAsync(artist.Context.Storage, artist.Id))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<YTracksPage> GetTracksAsync(this YArtist artist, int page = 0, int pageSize = 20)
|
||||
{
|
||||
return (await artist.Context.API.Artist.GetTracksAsync(artist.Context.Storage, artist.Id, page, pageSize))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<YTracksPage> GetTracksAsync(this YArtist artist, int page = 0, int pageSize = 20)
|
||||
{
|
||||
return (await artist.Context.API.Artist.GetTracksAsync(artist.Context.Storage, artist.Id, page, pageSize))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<List<YTrack>> GetAllTracksAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Artist.GetAllTracksAsync(artist.Context.Storage, artist.Id))
|
||||
.Result.Tracks;
|
||||
}
|
||||
public static async Task<List<YTrack>> GetAllTracksAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Artist.GetAllTracksAsync(artist.Context.Storage, artist.Id))
|
||||
.Result.Tracks;
|
||||
}
|
||||
|
||||
public static async Task<string> AddLikeAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Library.AddArtistLikeAsync(artist.Context.Storage, artist))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<string> AddLikeAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Library.AddArtistLikeAsync(artist.Context.Storage, artist))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<string> RemoveLikeAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Library.RemoveArtistLikeAsync(artist.Context.Storage, artist))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<string> RemoveLikeAsync(this YArtist artist)
|
||||
{
|
||||
return (await artist.Context.API.Library.RemoveArtistLikeAsync(artist.Context.Storage, artist))
|
||||
.Result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,56 +1,55 @@
|
||||
using YandexMusic.API.Models.Playlist;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для плейлиста
|
||||
/// </summary>
|
||||
public static partial class YPlaylistExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для плейлиста
|
||||
/// </summary>
|
||||
public static partial class YPlaylistExtensions
|
||||
private static bool CheckUser(YPlaylist playlist)
|
||||
{
|
||||
private static bool CheckUser(YPlaylist playlist)
|
||||
{
|
||||
return playlist.Owner.Uid == playlist.Context.Storage.User.Uid;
|
||||
}
|
||||
return playlist.Owner.Uid == playlist.Context.Storage.User.Uid;
|
||||
}
|
||||
|
||||
public static YPlaylist WithTracks(this YPlaylist playlist)
|
||||
{
|
||||
return WithTracksAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YPlaylist WithTracks(this YPlaylist playlist)
|
||||
{
|
||||
return WithTracksAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string AddLike(this YPlaylist playlist)
|
||||
{
|
||||
return AddLikeAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string AddLike(this YPlaylist playlist)
|
||||
{
|
||||
return AddLikeAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string RemoveLike(this YPlaylist playlist)
|
||||
{
|
||||
return RemoveLikeAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string RemoveLike(this YPlaylist playlist)
|
||||
{
|
||||
return RemoveLikeAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static YPlaylist Rename(this YPlaylist playlist, string newName)
|
||||
{
|
||||
return RenameAsync(playlist, newName).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YPlaylist Rename(this YPlaylist playlist, string newName)
|
||||
{
|
||||
return RenameAsync(playlist, newName).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static bool Delete(this YPlaylist playlist)
|
||||
{
|
||||
return DeleteAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
public static bool Delete(this YPlaylist playlist)
|
||||
{
|
||||
return DeleteAsync(playlist).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static YPlaylist InsertTracks(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return InsertTracksAsync(playlist, tracks).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YPlaylist InsertTracks(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return InsertTracksAsync(playlist, tracks).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static YPlaylist RemoveTracks(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return RemoveTracksAsync(playlist, tracks).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YPlaylist RemoveTracks(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return RemoveTracksAsync(playlist, tracks).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static bool UploadTracks(this YPlaylist playlist, string filePath, string fileName)
|
||||
{
|
||||
return UploadTracksAsync(playlist, filePath, fileName).GetAwaiter().GetResult();
|
||||
}
|
||||
public static bool UploadTracks(this YPlaylist playlist, string filePath, string fileName)
|
||||
{
|
||||
return UploadTracksAsync(playlist, filePath, fileName).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +1,71 @@
|
||||
using YandexMusic.API.Models.Playlist;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для плейлиста
|
||||
/// </summary>
|
||||
public static partial class YPlaylistExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для плейлиста
|
||||
/// </summary>
|
||||
public static partial class YPlaylistExtensions
|
||||
public static async Task<YPlaylist> WithTracksAsync(this YPlaylist playlist)
|
||||
{
|
||||
public static async Task<YPlaylist> WithTracksAsync(this YPlaylist playlist)
|
||||
{
|
||||
return playlist.Tracks != null
|
||||
? playlist
|
||||
: (await playlist.Context.API.Playlist.GetAsync(playlist.Context.Storage, playlist))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<string> AddLikeAsync(this YPlaylist playlist)
|
||||
{
|
||||
return (await playlist.Context.API.Library.AddPlaylistLikeAsync(playlist.Context.Storage, playlist))
|
||||
return playlist.Tracks != null
|
||||
? playlist
|
||||
: (await playlist.Context.API.Playlist.GetAsync(playlist.Context.Storage, playlist))
|
||||
.Result;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> RemoveLikeAsync(this YPlaylist playlist)
|
||||
{
|
||||
return (await playlist.Context.API.Library.RemovePlaylistLikeAsync(playlist.Context.Storage, playlist))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<string> AddLikeAsync(this YPlaylist playlist)
|
||||
{
|
||||
return (await playlist.Context.API.Library.AddPlaylistLikeAsync(playlist.Context.Storage, playlist))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<YPlaylist> RenameAsync(this YPlaylist playlist, string newName)
|
||||
{
|
||||
return CheckUser(playlist)
|
||||
? (await playlist.Context.API.Playlist.RenameAsync(playlist.Context.Storage, playlist, newName))
|
||||
.Result
|
||||
: playlist;
|
||||
}
|
||||
public static async Task<string> RemoveLikeAsync(this YPlaylist playlist)
|
||||
{
|
||||
return (await playlist.Context.API.Library.RemovePlaylistLikeAsync(playlist.Context.Storage, playlist))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<bool> DeleteAsync(this YPlaylist playlist)
|
||||
{
|
||||
return CheckUser(playlist) && await playlist.Context.API.Playlist.DeleteAsync(playlist.Context.Storage, playlist);
|
||||
}
|
||||
public static async Task<YPlaylist> RenameAsync(this YPlaylist playlist, string newName)
|
||||
{
|
||||
return CheckUser(playlist)
|
||||
? (await playlist.Context.API.Playlist.RenameAsync(playlist.Context.Storage, playlist, newName))
|
||||
.Result
|
||||
: playlist;
|
||||
}
|
||||
|
||||
public static async Task<YPlaylist> InsertTracksAsync(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return CheckUser(playlist)
|
||||
? (await playlist.Context.API.Playlist.InsertTracksAsync(playlist.Context.Storage, playlist, tracks))
|
||||
.Result
|
||||
: playlist;
|
||||
}
|
||||
public static async Task<bool> DeleteAsync(this YPlaylist playlist)
|
||||
{
|
||||
return CheckUser(playlist) && await playlist.Context.API.Playlist.DeleteAsync(playlist.Context.Storage, playlist);
|
||||
}
|
||||
|
||||
public static async Task<YPlaylist> RemoveTracksAsync(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return CheckUser(playlist)
|
||||
? (await playlist.Context.API.Playlist.DeleteTracksAsync(playlist.Context.Storage, playlist, tracks))
|
||||
.Result
|
||||
: playlist;
|
||||
}
|
||||
public static async Task<YPlaylist> InsertTracksAsync(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return CheckUser(playlist)
|
||||
? (await playlist.Context.API.Playlist.InsertTracksAsync(playlist.Context.Storage, playlist, tracks))
|
||||
.Result
|
||||
: playlist;
|
||||
}
|
||||
|
||||
public static async Task<bool> UploadTracksAsync(this YPlaylist playlist, string filePath, string fileName)
|
||||
{
|
||||
if (!CheckUser(playlist))
|
||||
return false;
|
||||
public static async Task<YPlaylist> RemoveTracksAsync(this YPlaylist playlist, params YTrack[] tracks)
|
||||
{
|
||||
return CheckUser(playlist)
|
||||
? (await playlist.Context.API.Playlist.DeleteTracksAsync(playlist.Context.Storage, playlist, tracks))
|
||||
.Result
|
||||
: playlist;
|
||||
}
|
||||
|
||||
string target = (await playlist.Context.API.UserGeneratedContent.GetUgcUploadLinkAsync(playlist.Context.Storage, playlist, fileName))
|
||||
.PostTarget;
|
||||
public static async Task<bool> UploadTracksAsync(this YPlaylist playlist, string filePath, string fileName)
|
||||
{
|
||||
if (!CheckUser(playlist))
|
||||
return false;
|
||||
|
||||
return (await playlist.Context.API.UserGeneratedContent.UploadUgcTrackAsync(playlist.Context.Storage, target, filePath))
|
||||
.Result == "CREATED";
|
||||
}
|
||||
string target = (await playlist.Context.API.UserGeneratedContent.GetUgcUploadLinkAsync(playlist.Context.Storage, playlist, fileName))
|
||||
.PostTarget;
|
||||
|
||||
return (await playlist.Context.API.UserGeneratedContent.UploadUgcTrackAsync(playlist.Context.Storage, target, filePath))
|
||||
.Result == "CREATED";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
using YandexMusic.API.Models.Radio;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для радиостанции
|
||||
/// </summary>
|
||||
public static partial class YStationResultExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для радиостанции
|
||||
/// </summary>
|
||||
public static partial class YStationResultExtensions
|
||||
public static List<YSequenceItem> GetTracks(this YStation station, string prevTrackId = "")
|
||||
{
|
||||
public static List<YSequenceItem> GetTracks(this YStation station, string prevTrackId = "")
|
||||
{
|
||||
return GetTracksAsync(station, prevTrackId).GetAwaiter().GetResult();
|
||||
}
|
||||
return GetTracksAsync(station, prevTrackId).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string SetSettings2(this YStation station, YStationSettings2 settings)
|
||||
{
|
||||
return SetSettings2Async(station, settings).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string SetSettings2(this YStation station, YStationSettings2 settings)
|
||||
{
|
||||
return SetSettings2Async(station, settings).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string SendFeedBack(this YStation station, YStationFeedbackType type, YTrack track = null, string batchId = "", double totalPlayedSeconds = 0)
|
||||
{
|
||||
return SendFeedBackAsync(station, type, track, batchId, totalPlayedSeconds).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string SendFeedBack(this YStation station, YStationFeedbackType type, YTrack track = null, string batchId = "", double totalPlayedSeconds = 0)
|
||||
{
|
||||
return SendFeedBackAsync(station, type, track, batchId, totalPlayedSeconds).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
using YandexMusic.API.Models.Radio;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для радиостанции
|
||||
/// </summary>
|
||||
public static partial class YStationResultExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для радиостанции
|
||||
/// </summary>
|
||||
public static partial class YStationResultExtensions
|
||||
public static async Task<List<YSequenceItem>> GetTracksAsync(this YStation station, string prevTrackId = "")
|
||||
{
|
||||
public static async Task<List<YSequenceItem>> GetTracksAsync(this YStation station, string prevTrackId = "")
|
||||
{
|
||||
return (await station.Context.API.Radio.GetStationTracksAsync(station.Context.Storage, station, prevTrackId))
|
||||
.Result.Sequence;
|
||||
}
|
||||
return (await station.Context.API.Radio.GetStationTracksAsync(station.Context.Storage, station, prevTrackId))
|
||||
.Result.Sequence;
|
||||
}
|
||||
|
||||
public static async Task<string> SetSettings2Async(this YStation station, YStationSettings2 settings)
|
||||
{
|
||||
return (await station.Context.API.Radio.SetStationSettings2Async(station.Context.Storage, station, settings))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<string> SetSettings2Async(this YStation station, YStationSettings2 settings)
|
||||
{
|
||||
return (await station.Context.API.Radio.SetStationSettings2Async(station.Context.Storage, station, settings))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static Task<string> SendFeedBackAsync(this YStation station, YStationFeedbackType type, YTrack track = null, string batchId = "", double totalPlayedSeconds = 0)
|
||||
{
|
||||
return station.Context.API.Radio.SendStationFeedBackAsync(station.Context.Storage, station, type, track, batchId, totalPlayedSeconds);
|
||||
}
|
||||
public static Task<string> SendFeedBackAsync(this YStation station, YStationFeedbackType type, YTrack track = null, string batchId = "", double totalPlayedSeconds = 0)
|
||||
{
|
||||
return station.Context.API.Radio.SendStationFeedBackAsync(station.Context.Storage, station, type, track, batchId, totalPlayedSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,54 @@
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для трека
|
||||
/// </summary>
|
||||
public static partial class YTrackExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для трека
|
||||
/// </summary>
|
||||
public static partial class YTrackExtensions
|
||||
public static string GetLink(this YTrack track)
|
||||
{
|
||||
public static string GetLink(this YTrack track)
|
||||
{
|
||||
return GetLinkAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
return GetLinkAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static void Save(this YTrack track, string filePath)
|
||||
{
|
||||
SaveAsync(track, filePath).GetAwaiter().GetResult();
|
||||
}
|
||||
public static void Save(this YTrack track, string filePath)
|
||||
{
|
||||
SaveAsync(track, filePath).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static int AddLike(this YTrack track)
|
||||
{
|
||||
return AddLikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
public static int AddLike(this YTrack track)
|
||||
{
|
||||
return AddLikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static int RemoveLike(this YTrack track)
|
||||
{
|
||||
return RemoveLikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
public static int RemoveLike(this YTrack track)
|
||||
{
|
||||
return RemoveLikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static int AddDislike(this YTrack track)
|
||||
{
|
||||
return AddDislikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
public static int AddDislike(this YTrack track)
|
||||
{
|
||||
return AddDislikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static int RemoveDislike(this YTrack track)
|
||||
{
|
||||
return RemoveDislikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
public static int RemoveDislike(this YTrack track)
|
||||
{
|
||||
return RemoveDislikeAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static string SendPlayTrackInfo(this YTrack track, string from, bool fromCache = false, string playId = "", string playlistId = "", double totalPlayedSeconds = 0, double endPositionSeconds = 0)
|
||||
{
|
||||
return SendPlayTrackInfoAsync(track, from, fromCache, playId, playlistId, totalPlayedSeconds).GetAwaiter().GetResult();
|
||||
}
|
||||
public static string SendPlayTrackInfo(this YTrack track, string from, bool fromCache = false, string playId = "", string playlistId = "", double totalPlayedSeconds = 0, double endPositionSeconds = 0)
|
||||
{
|
||||
return SendPlayTrackInfoAsync(track, from, fromCache, playId, playlistId, totalPlayedSeconds).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static YTrackSupplement Supplement(this YTrack track)
|
||||
{
|
||||
return SupplementAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YTrackSupplement Supplement(this YTrack track)
|
||||
{
|
||||
return SupplementAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public static YTrackSimilar Similar(this YTrack track)
|
||||
{
|
||||
return SimilarAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
public static YTrackSimilar Similar(this YTrack track)
|
||||
{
|
||||
return SimilarAsync(track).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +1,60 @@
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Extensions.API
|
||||
namespace YandexMusic.API.Extensions.API;
|
||||
|
||||
/// <summary>
|
||||
/// Методы-расширения для трека
|
||||
/// </summary>
|
||||
public static partial class YTrackExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Методы-расширения для трека
|
||||
/// </summary>
|
||||
public static partial class YTrackExtensions
|
||||
public static Task<string> GetLinkAsync(this YTrack track)
|
||||
{
|
||||
public static Task<string> GetLinkAsync(this YTrack track)
|
||||
{
|
||||
return track.Context.API.Track.GetFileLinkAsync(track.Context.Storage, track);
|
||||
}
|
||||
return track.Context.API.Track.GetFileLinkAsync(track.Context.Storage, track);
|
||||
}
|
||||
|
||||
public static Task SaveAsync(this YTrack track, string filePath)
|
||||
{
|
||||
return track.Context.API.Track.ExtractToFileAsync(track.Context.Storage, track, filePath);
|
||||
}
|
||||
public static Task SaveAsync(this YTrack track, string filePath)
|
||||
{
|
||||
return track.Context.API.Track.ExtractToFileAsync(track.Context.Storage, track, filePath);
|
||||
}
|
||||
|
||||
public static async Task<int> AddLikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.AddTrackLikeAsync(track.Context.Storage, track))
|
||||
.Result.Revision;
|
||||
}
|
||||
public static async Task<int> AddLikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.AddTrackLikeAsync(track.Context.Storage, track))
|
||||
.Result.Revision;
|
||||
}
|
||||
|
||||
public static async Task<int> RemoveLikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.RemoveTrackLikeAsync(track.Context.Storage, track))
|
||||
.Result.Revision;
|
||||
}
|
||||
public static async Task<int> RemoveLikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.RemoveTrackLikeAsync(track.Context.Storage, track))
|
||||
.Result.Revision;
|
||||
}
|
||||
|
||||
public static async Task<int> AddDislikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.AddTrackDislikeAsync(track.Context.Storage, track))
|
||||
.Result.Revision;
|
||||
}
|
||||
public static async Task<int> AddDislikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.AddTrackDislikeAsync(track.Context.Storage, track))
|
||||
.Result.Revision;
|
||||
}
|
||||
|
||||
public static async Task<int> RemoveDislikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.RemoveTrackDislikeAsync(track.Context.Storage, track))
|
||||
?.Result.Revision ?? -1;
|
||||
}
|
||||
public static async Task<int> RemoveDislikeAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Library.RemoveTrackDislikeAsync(track.Context.Storage, track))
|
||||
?.Result.Revision ?? -1;
|
||||
}
|
||||
|
||||
public static Task<string> SendPlayTrackInfoAsync(this YTrack track, string from, bool fromCache = false, string playId = "", string playlistId = "", double totalPlayedSeconds = 0, double endPositionSeconds = 0)
|
||||
{
|
||||
return track.Context.API.Track.SendPlayTrackInfoAsync(track.Context.Storage, track, from, fromCache, playId, playlistId, totalPlayedSeconds);
|
||||
}
|
||||
public static Task<string> SendPlayTrackInfoAsync(this YTrack track, string from, bool fromCache = false, string playId = "", string playlistId = "", double totalPlayedSeconds = 0, double endPositionSeconds = 0)
|
||||
{
|
||||
return track.Context.API.Track.SendPlayTrackInfoAsync(track.Context.Storage, track, from, fromCache, playId, playlistId, totalPlayedSeconds);
|
||||
}
|
||||
|
||||
public static async Task<YTrackSupplement> SupplementAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Track.GetSupplementAsync(track.Context.Storage, track))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<YTrackSupplement> SupplementAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Track.GetSupplementAsync(track.Context.Storage, track))
|
||||
.Result;
|
||||
}
|
||||
|
||||
public static async Task<YTrackSimilar> SimilarAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Track.GetSimilarAsync(track.Context.Storage, track))
|
||||
.Result;
|
||||
}
|
||||
public static async Task<YTrackSimilar> SimilarAsync(this YTrack track)
|
||||
{
|
||||
return (await track.Context.API.Track.GetSimilarAsync(track.Context.Storage, track))
|
||||
.Result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user