Обнновлено до .net10
This commit is contained in:
@@ -6,33 +6,32 @@ using YandexMusic.API.Models.Track;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Track
|
||||
namespace YandexMusic.API.Requests.Track;
|
||||
|
||||
[YApiRequest(WebRequestMethods.Http.Post, "play-audio")]
|
||||
public class YSendTrackInfoBuilder : YRequestBuilder<string, (YTrack track, string from, bool fromCache, string playId, string playlistId, double totalPlayedSeconds, double endPositionSeconds)>
|
||||
{
|
||||
[YApiRequest(WebRequestMethods.Http.Post, "play-audio")]
|
||||
public class YSendTrackInfoBuilder : YRequestBuilder<string, (YTrack track, string from, bool fromCache, string playId, string playlistId, double totalPlayedSeconds, double endPositionSeconds)>
|
||||
public YSendTrackInfoBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
public YSendTrackInfoBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent((YTrack track, string from, bool fromCache, string playId, string playlistId, double totalPlayedSeconds, double endPositionSeconds) tuple)
|
||||
{
|
||||
Dictionary<string, string> formData = new() {
|
||||
{ "track_id", tuple.track.Id },
|
||||
{ "from-cache", tuple.fromCache.ToString() },
|
||||
{ "play_id", tuple.playId },
|
||||
{ "uid", Storage.User.Uid },
|
||||
{ "timestamp", DateTime.Now.ToString("o", CultureInfo.InvariantCulture) },
|
||||
{ "client-now", DateTime.Now.ToString("o", CultureInfo.InvariantCulture) },
|
||||
{ "album-id", tuple.track.Albums.FirstOrDefault()?.Id },
|
||||
{ "from", tuple.from },
|
||||
{ "playlist-id", tuple.playlistId },
|
||||
{ "track-length-seconds", ((double)(tuple.track.DurationMs / 1000)).ToString(CultureInfo.InvariantCulture) },
|
||||
{ "total-played-seconds", tuple.totalPlayedSeconds.ToString(CultureInfo.InvariantCulture) },
|
||||
{ "end-position-seconds", tuple.endPositionSeconds.ToString(CultureInfo.InvariantCulture) },
|
||||
};
|
||||
protected override HttpContent GetContent((YTrack track, string from, bool fromCache, string playId, string playlistId, double totalPlayedSeconds, double endPositionSeconds) tuple)
|
||||
{
|
||||
Dictionary<string, string> formData = new() {
|
||||
{ "track_id", tuple.track.Id },
|
||||
{ "from-cache", tuple.fromCache.ToString() },
|
||||
{ "play_id", tuple.playId },
|
||||
{ "uid", storage.User.Uid },
|
||||
{ "timestamp", DateTime.Now.ToString("o", CultureInfo.InvariantCulture) },
|
||||
{ "client-now", DateTime.Now.ToString("o", CultureInfo.InvariantCulture) },
|
||||
{ "album-id", tuple.track.Albums.FirstOrDefault()?.Id },
|
||||
{ "from", tuple.from },
|
||||
{ "playlist-id", tuple.playlistId },
|
||||
{ "track-length-seconds", ((double)(tuple.track.DurationMs / 1000)).ToString(CultureInfo.InvariantCulture) },
|
||||
{ "total-played-seconds", tuple.totalPlayedSeconds.ToString(CultureInfo.InvariantCulture) },
|
||||
{ "end-position-seconds", tuple.endPositionSeconds.ToString(CultureInfo.InvariantCulture) },
|
||||
};
|
||||
|
||||
return new FormUrlEncodedContent(formData);
|
||||
}
|
||||
return new FormUrlEncodedContent(formData);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user