internal static YSearchAlbumModel FromJson(JToken json)
        {
            if (json == null)
            {
                return(null);
            }

            return(new YSearchAlbumModel
            {
                Id = json.SelectToken("id")?.ToObject <string>(),
                StorageDir = json.SelectToken("storageDir")?.ToObject <string>(),
                OriginalReleaseYear = json.SelectToken("originalReleaseYear")?.ToObject <int>(),
                Year = json.SelectToken("year")?.ToObject <int>(),
                Artists = json.SelectToken("artists")?.Select(x => YSearchArtist.FromJson(x)).ToList(),
                CoverUri = json.SelectToken("coverUri")?.ToObject <string>(),
                TrackCount = json.SelectToken("trackCount")?.ToObject <int>(),
                Genre = json.SelectToken("genre")?.ToObject <string>(),
                Available = json.SelectToken("available")?.ToObject <bool>(),
                AvailableForPremiumUsers = json.SelectToken("availableForPremiumUsers")?.ToObject <bool>(),
                Title = json.SelectToken("title")?.ToObject <string>(),
                TrackPosition = YTrackPosition.FromJson(json.SelectToken("trackPosition")),
                Type = json.SelectToken("type")?.ToObject <string>(),
                Regions = json.SelectToken("regions")?.Select(x => x.ToObject <string>()).ToList(),
            });
        }
Beispiel #2
0
        internal static YSearchTrackModel FromJson(JToken json)
        {
            if (json == null)
            {
                return(null);
            }

            return(new YSearchTrackModel
            {
                Id = json.SelectToken("id")?.ToObject <string>(),
                Available = json.SelectToken("available")?.ToObject <bool>(),
                AvailableAsRbt = json.SelectToken("availableAsRbt")?.ToObject <bool>(),
                AvailableForPremiumUsers = json.SelectToken("availableForPremiumUsers")?.ToObject <bool>(),
                LyricsAvailable = json.SelectToken("lyricsAvailable")?.ToObject <bool>(),
                RememberPosition = json.SelectToken("rememberPosition")?.ToObject <bool>(),
                Albums = json.SelectToken("albums")?.Select(x => YSearchAlbumModel.FromJson(x)).ToList(),
                StorageDir = json.SelectToken("storageDir")?.ToObject <string>(),
                DurationMs = json.SelectToken("durationMs")?.ToObject <long>(),
                Explicit = json.SelectToken("explicit")?.ToObject <bool>(),
                Title = json.SelectToken("title")?.ToObject <string>(),
                Artists = json.SelectToken("artists")?.Select(x => YSearchArtist.FromJson(x)).ToList(),
                Regions = json.SelectToken("regions")?.Select(x => x.ToObject <string>()).ToList()
            });
        }