Добавьте файлы проекта.

This commit is contained in:
FrigaT
2026-04-10 12:12:33 +03:00
parent 9615cf42ee
commit 11d0b0d72f
383 changed files with 9661 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
namespace YandexMusic.API.Models.Radio.Restriction
{
public sealed class YRestrictionConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(YRestriction).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
JObject jObject = JObject.Load(reader);
YRestriction restriction;
try
{
YRestrictionType type = jObject["type"].ToObject<YRestrictionType>();
switch (type)
{
case YRestrictionType.Enum:
restriction = jObject.ToObject<YRestrictionEnum>();
break;
case YRestrictionType.DiscreteScale:
restriction = jObject.ToObject<YRestrictionDiscreteScale>();
break;
default:
restriction = jObject.ToObject<YRestriction>();
break;
}
}
catch (Exception ex)
{
throw new Exception($"Ошибка десериализации типа \"{objectType.Name}\".", ex);
}
return restriction;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
public class YRestriction
{
public string Name { get; set; }
public YRestrictionType Type { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Radio.Restriction
{
public class YRestrictionDiscreteScale : YRestriction
{
public YRestrictionValue<int> Min { get; set; }
public YRestrictionValue<int> Max { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace YandexMusic.API.Models.Radio.Restriction
{
public class YRestrictionEnum : YRestriction
{
public List<YRestrictionValue<string>> PossibleValues { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System.Runtime.Serialization;
namespace YandexMusic.API.Models.Radio.Restriction
{
[JsonConverter(typeof(StringEnumConverter))]
public enum YRestrictionType
{
[EnumMember(Value = "discrete-scale")]
DiscreteScale,
Enum
}
}

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Radio.Restriction
{
public class YRestrictionValue<T>
{
public string Name { get; set; }
public T Value { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
namespace YandexMusic.API.Models.Radio
{
public class YAdParams
{
public decimal AdVolume { get; set; }
public string CategoryId { get; set; }
public int GenreId { get; set; }
public string GenreName { get; set; }
public string OtherParams { get; set; }
public string PageRef { get; set; }
public string PartnerId { get; set; }
public string TargetRef { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace YandexMusic.API.Models.Radio
{
public class YBrand
{
public string AdvertiserUrl { get; set; }
public string BackgroundColor { get; set; }
public string BackgroundImageUri { get; set; }
public string GlowColor { get; set; }
public string MainImageUri { get; set; }
public string Theme { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using YandexMusic.API.Models.Track;
namespace YandexMusic.API.Models.Radio
{
public class YSequenceItem
{
public bool Liked { get; set; }
public YTrack Track { get; set; }
public YTrackParameters TrackParameters { get; set; }
public string Type { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using YandexMusic.API.Models.Common;
namespace YandexMusic.API.Models.Radio
{
public class YStation : YBaseModel
{
public YAdParams AdParams { get; set; }
public string CustomName { get; set; }
public YStationData Data { get; set; }
public string Explanation { get; set; }
public List<YPrerolls> Prerolls { get; set; }
public string RupTitle { get; set; }
public string RupDescription { get; set; }
public YStationSettings Settings { get; set; }
public YStationSettings2 Settings2 { get; set; }
public YStationDescription Station { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using YandexMusic.API.Models.Artist;
namespace YandexMusic.API.Models.Radio
{
public class YStationData
{
public List<YArtist> Artists { get; set; }
public YBrand Brand { get; set; }
public string Description { get; set; }
public string ImageUri { get; set; }
public string Title { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationDescription
{
public string FullImageUrl { get; set; }
public YStationIcon GeocellIcon { get; set; }
public YStationIcon Icon { get; set; }
public YStationId Id { get; set; }
public string IdForFrom { get; set; }
public string MtsFullImageUrl { get; set; }
public YStationIcon MtsIcon { get; set; }
public string Name { get; set; }
public YStationId ParentId { get; set; }
public YStationRestrictions Restrictions { get; set; }
public YStationRestrictions2 Restrictions2 { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Radio
{
internal sealed class YStationFeedback
{
public YStationFeedbackType Type { get; set; }
public long Timestamp { get; set; }
public string From { get; set; }
public double TotalPlayedSeconds { get; set; }
public string TrackId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace YandexMusic.API.Models.Radio
{
public enum YStationFeedbackType
{
RadioStarted,
TrackStarted,
TrackFinished,
Skip
}
}

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationIcon
{
public string BackgroundColor { get; set; }
public string ImageUrl { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationId
{
public string Tag { get; set; }
public string Type { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using YandexMusic.API.Models.Radio.Restriction;
namespace YandexMusic.API.Models.Radio
{
public class YStationRestrictions
{
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction Diversity { get; set; }
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction Energy { get; set; }
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction Language { get; set; }
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction Mood { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using YandexMusic.API.Models.Radio.Restriction;
namespace YandexMusic.API.Models.Radio
{
public class YStationRestrictions2
{
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction Diversity { get; set; }
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction Language { get; set; }
[JsonConverter(typeof(YRestrictionConverter))]
public YRestriction MoodEnergy { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationSequence
{
public string BatchId { get; set; }
public YStationId Id { get; set; }
public bool Pumpkin { get; set; }
public string RadioSessionId { get; set; }
public List<YSequenceItem> Sequence { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationSettings
{
public string Diversity { get; set; }
public string Energy { get; set; }
public string Language { get; set; }
public string Mood { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationSettings2
{
public string Diversity { get; set; }
public string Language { get; set; }
public string MoodEnergy { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Radio
{
public class YStationsDashboard
{
public string DashboardId { get; set; }
public bool Pumpkin { get; set; }
public List<YStation> Stations { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Radio
{
public class YTrackParameters
{
public int Bpm { get; set; }
public int Hue { get; set; }
public decimal Energy { get; set; }
}
}