Example #1
0
        public static YandexPlaylist FromJson(JToken jList)
        {
            var playlist = new YandexPlaylist
            {
                Collective = jList.GetBool("collective"),
                Cover      = jList.ContainField("cover") ?
                             YandexCover.FromJson(jList["cover"]) : null,
                Description           = jList.GetString("description"),
                DescriptionFormatted  = jList.GetString("descriptionFormatted"),
                Duration              = jList.GetInt("Duration"),
                GeneratedPlaylistType = jList.GetString("generatedPlaylistType"),
                IdForFrom             = jList.GetString("IdForFrom"),
                Kind       = jList.GetInt("kind"),
                LikesCount = jList.GetInt("likesCount"),
                Modified   = jList.GetString("modified"),
                OgImage    = jList.GetString("ogImage"),
                Owner      = jList.ContainField("owner") ?
                             YandexOwner.FromJson(jList["owner"]) : null,
                Revision   = jList.GetInt("revision"),
                Title      = jList.GetString("title"),
                TrackCount = jList.GetInt("trackCount"),
                Visibility = jList.GetString("visibility"),
                TrackIds   = jList.ContainField("trackIds")
          ? jList["trackIds"].Select(x => int.Parse(x.ToString())).ToList() : null,
                Tracks = jList.ContainField("tracks")
          ? YandexTrack.FromJsonArray(jList["tracks"].ToObject <JArray>())
          : null
            };

            return(playlist);
        }
Example #2
0
        public static YandexCover FromJson(JToken jCover)
        {
            var cover = new YandexCover
            {
                Type    = jCover.GetString("type"),
                Prefix  = jCover.GetString("prefix"),
                Url     = jCover.GetString("uri"),
                Custom  = jCover.GetBool("custom"),
                Dir     = jCover.GetString("dir"),
                Version = jCover.GetString("version")
            };

            return(cover);
        }
Example #3
0
        public static YandexArtist FromJson(JToken jArtist)
        {
            var artist = new YandexArtist
            {
                Id       = jArtist.GetString("id"),
                Name     = jArtist.GetString("name"),
                Various  = jArtist.GetBool("various"),
                Composer = jArtist.GetBool("composer"),
                Cover    = jArtist.ContainField("cover") ? YandexCover.FromJson(jArtist["cover"]) : null,
                Genres   = new string[] { }
            };

            return(artist);
        }