Skip to content

Commit

Permalink
Добавлены модели, исправлена кодировка файлов
Browse files Browse the repository at this point in the history
  • Loading branch information
K1llMan committed Mar 6, 2022
1 parent 3cf2694 commit 1e0a378
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 43 deletions.
3 changes: 2 additions & 1 deletion Yandex.Music.Api.Tests/Traits/YandexTraitDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class YandexTraitDiscoverer : ITraitDiscoverer
var args = (List<object>) traitAttribute.GetConstructorArguments();
var groups = (Array) args[0];

foreach (var nameGroup in groups) yield return new KeyValuePair<string, string>(Category, nameGroup.ToString());
foreach (var nameGroup in groups)
yield return new KeyValuePair<string, string>(Category, nameGroup.ToString());
}
}
}
1 change: 1 addition & 0 deletions Yandex.Music.Api.Tests/Yandex.Music.Api.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net5.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IsPackable>false</IsPackable>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
Expand Down
9 changes: 6 additions & 3 deletions Yandex.Music.Api/Models/Account/YAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ namespace Yandex.Music.Api.Models.Account
{
public class YAuth
{
[JsonProperty("access_token")] public string AccessToken { get; set; }
[JsonProperty("access_token")]
public string AccessToken { get; set; }

[JsonProperty("expires_in")] public string Expires { get; set; }
[JsonProperty("expires_in")]
public string Expires { get; set; }

[JsonProperty("token_type")] public string TokenType { get; set; }
[JsonProperty("token_type")]
public string TokenType { get; set; }

public string Uid { get; set; }
}
Expand Down
2 changes: 1 addition & 1 deletion Yandex.Music.Api/Models/Artist/YArtist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class YArtist : YBaseModel
public YCover Cover { get; set; }

public List<string> DbAliases { get; set; }
#warning Íåïîíÿòíàÿ êîëëåêöèÿ ñ ñîäåðæèìûì ðàçíûõ òèïîâ
#warning Непонятная коллекция с содержимым разных типов
public List<object> Decomposed { get; set; }
public YDescription Description { get; set; }
public string EndDate { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Models/Artist/YArtistCounts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ namespace Yandex.Music.Api.Models.Artist
{
public class YArtistCounts
{
#region Ñâîéñòâà
#region Свойства

public int AlsoAlbums { get; set; }
public int AlsoTracks { get; set; }
public int DirectAlbums { get; set; }
public int Tracks { get; set; }

#endregion
#endregion Свойства
}
}
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Models/Artist/YArtistRatings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ namespace Yandex.Music.Api.Models.Artist
{
public class YArtistRatings
{
#region Ñâîéñòâà
#region Свойства

public int Day { get; set; }
public int Month { get; set; }
public int Week { get; set; }

#endregion
#endregion Свойства
}
}
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Models/Artist/YConcert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Yandex.Music.Api.Models.Artist
{
public class YConcert
{
#region Ñâîéñòâà
#region Свойства

public string Address { get; set; }
public string AfishaUrl { get; set; }
Expand All @@ -28,6 +28,6 @@ public class YConcert
public List<YMetroStation> MetroStations { get; set; }
public string Place { get; set; }

#endregion
#endregion Свойства
}
}
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Models/Artist/YMetroStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ namespace Yandex.Music.Api.Models.Artist
{
public class YMetroStation
{
#region Ñâîéñòâà
#region Свойства

[JsonProperty("line-color")]
public string LineColor { get; set; }
public string Title { get; set; }

#endregion
#endregion Свойства
}
}
2 changes: 1 addition & 1 deletion Yandex.Music.Api/Models/Common/Cover/YCover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
}
}
catch (Exception ex) {
throw new Exception($"Îøèáêà äåñåðèàëèçàöèè òèïà \"{objectType.Name}\".", ex);
throw new Exception($"Ошибка десериализации типа \"{objectType.Name}\".", ex);
}

return cover;
Expand Down
8 changes: 8 additions & 0 deletions Yandex.Music.Api/Models/Common/YLyricsInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Yandex.Music.Api.Models.Common
{
public class YLyricsInfo
{
public bool HasAvailableSyncLyrics { get; set;}
public bool HasAvailableTextLyrics { get; set; }
}
}
2 changes: 1 addition & 1 deletion Yandex.Music.Api/Models/Landing/YLandingBlockEntityData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class YLandingBlockEntityData
public bool Ready { get; set; }
public YGeneratedPlaylistType Type { get; set; }

#endregion
#endregion Свойства
}
}
8 changes: 4 additions & 4 deletions Yandex.Music.Api/Models/Playlist/YPlaylist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Yandex.Music.Api.Models.Playlist
{
public class YPlaylist : YBaseModel
{
#region Ïîëÿ
#region Поля

public YPlaylistUidPair GetKey()
{
Expand All @@ -21,9 +21,9 @@ public YPlaylistUidPair GetKey()
};
}

#endregion
#endregion Поля

#region Ñâîéñòâà
#region Свойства

public YButton ActionButton { get; set; }
public string AnimatedCoverUri { get; set; }
Expand Down Expand Up @@ -78,6 +78,6 @@ public YPlaylistUidPair GetKey()
public string UrlPart { get; set; }
public string Visibility { get; set; }

#endregion
#endregion Свойства
}
}
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Models/Playlist/YPlaylistChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Yandex.Music.Api.Models.Playlist
{
public class YPlaylistChange
{
#region Ñâîéñòâà
#region Свойства

public int? At { get; set; }

Expand All @@ -20,6 +20,6 @@ public class YPlaylistChange

public List<YTrackAlbumPair> Tracks { get; set; }

#endregion
#endregion Свойства
}
}
8 changes: 4 additions & 4 deletions Yandex.Music.Api/Models/Playlist/YPlaylistMadeFor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class YPlaylistMadeFor
{
public class YMadeForCaseForms
{
#region Ñâîéñòâà
#region Свойства

public string Accusative { get; set; }
public string Dative { get; set; }
Expand All @@ -15,14 +15,14 @@ public class YMadeForCaseForms
public string Nominative { get; set; }
public string Prepositional { get; set; }

#endregion
#endregion Свойства
}

#region Ñâîéñòâà
#region Свойства

public YMadeForCaseForms CaseForms { get; set; }
public YOwner UserInfo { get; set; }

#endregion
#endregion Свойства
}
}
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Models/Playlist/YPlaylistPlayCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ namespace Yandex.Music.Api.Models.Playlist
{
public class YPlaylistPlayCounter
{
#region Ñâîéñòâà
#region Свойства

public string Description { get; set; }
public string DescriptionNext { get; set; }
public bool Updated { get; set; }
public int?Value { get; set; }

#endregion
#endregion Свойства
}
}
8 changes: 4 additions & 4 deletions Yandex.Music.Api/Models/Playlist/YPlaylistUidPair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ namespace Yandex.Music.Api.Models.Playlist
{
public class YPlaylistUidPair
{
#region Ïîëÿ
#region Поля

public override string ToString()
{
return $"{Uid}:{Kind}";
}

#endregion
#endregion Поля

#region Ñâîéñòâà
#region Свойства

public string Kind { get; set; }
public string Uid { get; set; }

#endregion
#endregion Свойства
}
}
1 change: 1 addition & 0 deletions Yandex.Music.Api/Models/Search/Track/YSearchTrackModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class YSearchTrackModel
public bool Explicit { get; set; }
public string Id { get; set; }
public bool LyricsAvailable { get; set; }
public YLyricsInfo LyricsInfo { get; set; }
public List<string> Regions { get; set; }
public bool RememberPosition { get; set; }
public string StorageDir { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion Yandex.Music.Api/Models/Track/YTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ public YTrackAlbumPair GetKey()
public long FileSize { get; set; }
public string Id { get; set; }
public bool IsSuitableForChildren { get; set; }
public bool LyricsAvailable { get; set; }
public bool HasLyrics { get; set; }
public bool HasSyncLyrics { get; set; }
public YMajor Major { get; set; }
public YTrackNormalization Normalization { get; set; }
public YTrackNormalizationR128 R128 { get; set; }
public string OgImage { get; set; }
public bool LyricsAvailable { get; set; }
public YLyricsInfo LyricsInfo { get; set; }
public string PlayerId { get; set; }
public long PreviewDurationMs { get; set; }
public YPodcastEpisodeType PodcastEpisodeType { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Requests/Playlist/YPlaylistChangeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Yandex.Music.Api.Requests.Playlist
{
internal class YPlaylistChangeRequest : YRequest
{
#region Ïîëÿ
#region Поля

private JsonSerializerSettings settings = new JsonSerializerSettings {
Converters = new List<JsonConverter> {
Expand All @@ -24,7 +24,7 @@ internal class YPlaylistChangeRequest : YRequest
ContractResolver = new CamelCasePropertyNamesContractResolver()
};

#endregion Ïîëÿ
#endregion Поля

public YPlaylistChangeRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
{
Expand Down
4 changes: 2 additions & 2 deletions Yandex.Music.Api/Requests/Radio/YSetSettings2Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Yandex.Music.Api.Requests.Track
{
internal class YSetSettings2Request : YRequest
{
#region Ïîëÿ
#region Поля

private JsonSerializerSettings settings = new JsonSerializerSettings
{
Expand All @@ -25,7 +25,7 @@ internal class YSetSettings2Request : YRequest
ContractResolver = new CamelCasePropertyNamesContractResolver()
};

#endregion Ïîëÿ
#endregion Поля

public YSetSettings2Request(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ public YStorageDownloadFileRequest(YandexMusicApi yandex, AuthStorage storage) :

public YRequest Create(string src)
{

var query = new Dictionary<string, string> {
Dictionary<string, string> query = new Dictionary<string, string> {
{"format", "json"}
};


var parts = src.Split('?');
string[] parts = src.Split('?');
parts[1].Split('&').ToList().ForEach(p => {
var param = p.Split('=');
string[] param = p.Split('=');
query.Add(param[0], param[1]);
});

Expand Down
1 change: 0 additions & 1 deletion Yandex.Music.Api/Requests/YEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ internal static class YEndpoints
public static string PlaylistPatch = "https://music.yandex.ru/handlers/playlist-patch.jsx";
public static string Search = "https://music.yandex.ru/handlers/music-search.jsx";
public static string Track = "https://music.yandex.ru/handlers/track.jsx";

}
}
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit 1e0a378

Please sign in to comment.