public List <MusicVideo> GetRecentlyAddedMusicVideos(string[] fields, SortParams sort) { var args = new JObject(); if (fields != null) { args.Add(new JProperty("fields", fields)); } if (sort != null) { args.Add(sort.ToJObject().Children()); } List <MusicVideo> list = new List <MusicVideo>(); JObject query = (JObject)Client.Invoke("VideoLibrary.GetRecentlyAddedMusicVideos", args); if (query["musicvideos"] != null) { foreach (JObject item in (JArray)query["musicvideos"]) { list.Add(MusicVideo.MusicVideoFromJsonObject(item)); } } return(list); }
public static MusicVideo MusicVideoFromPlaylistItem(PlaylistItem item) { MusicVideo e = new MusicVideo( item._id, item.File, item.Label, item.Thumbnail, item.Artist, item.Title, item.Genre, item.Album, item.Year, item.Rating ); return(e); }
public static MusicVideo MusicVideoFromJsonObject(JObject item) { MusicVideo e = new MusicVideo( (item["musicvideoid"] != null) ? Convert.ToInt32(item["musicvideoid"].Value <JValue>().Value) : -1, item["file"].Value <JValue>().Value.ToString(), item["label"].Value <JValue>().Value.ToString(), (item["thumbnail"] != null) ? item["thumbnail"].Value <JValue>().Value.ToString() : "", (item["artist"] != null) ? item["artist"].Value <JValue>().Value.ToString() : "", (item["title"] != null) ? item["title"].Value <JValue>().Value.ToString() : "", (item["genre"] != null) ? item["genre"].Value <JValue>().Value.ToString() : "", (item["album"] != null) ? item["album"].Value <JValue>().Value.ToString() : "", (item["year"] != null) ? Convert.ToInt32(item["year"].Value <JValue>().Value) : -1, (item["rating"] != null) ? (float)Convert.ToDouble(item["rating"].Value <JValue>().Value) : -1 ); return(e); }