Exemplo n.º 1
0
        public List <Song> GetSongsByArtistAndAlbum(int?artistId, int?albumId, string[] fields, SortParams sort)
        {
            var args = new JObject();

            if (artistId != null)
            {
                args.Add(new JProperty("artistid", artistId));
            }
            if (albumId != null)
            {
                args.Add(new JProperty("albumid", albumId));
            }
            if (fields != null)
            {
                args.Add(new JProperty("fields", fields));
            }
            if (sort != null)
            {
                args.Add(sort.ToJObject().Children());
            }

            JObject     query = (JObject)Client.Invoke("AudioLibrary.GetSongs", args);
            List <Song> list  = new List <Song>();

            if (query != null)
            {
                foreach (JObject item in (JArray)query["songs"])
                {
                    list.Add(Song.SongFromJsonObject(item));
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        public List <Album> GetAlbums(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());
            }

            JObject      query = (JObject)Client.Invoke("AudioLibrary.GetAlbums", args);
            List <Album> list  = new List <Album>();

            if (query != null)
            {
                foreach (JObject item in (JArray)query["albums"])
                {
                    list.Add(Album.AlbumFromJsonObject(item));
                }
            }

            return(list);
        }
Exemplo n.º 3
0
        public List <Song> GetSongsByGenre(string genre, string[] fields, SortParams sort)
        {
            var args = new JObject();

            if (genre != null)
            {
                args.Add(new JProperty("genre", genre));
            }
            if (fields != null)
            {
                args.Add(new JProperty("fields", fields));
            }
            if (sort != null)
            {
                args.Add(sort.ToJObject().Children());
            }

            JObject     query = (JObject)Client.Invoke("AudioLibrary.GetSongs", args);
            List <Song> list  = new List <Song>();

            if (query != null)
            {
                foreach (JObject item in (JArray)query["songs"])
                {
                    list.Add(Song.SongFromJsonObject(item));
                }
            }

            return(list);
        }
Exemplo n.º 4
0
        public List <TvShow> GetTvShows(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 <TvShow> list  = new List <TvShow>();
            JObject       query = (JObject)Client.Invoke("VideoLibrary.GetTvShows", args);

            if (query["tvshows"] != null)
            {
                foreach (JObject item in (JArray)query["tvshows"])
                {
                    list.Add(TvShow.TvShowFromJsonObject(item));
                }
            }

            return(list);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        public List <Episode> GetEpisodes(int?tvShowId, int?season, string[] fields, SortParams sort)
        {
            var args = new JObject();

            if (tvShowId != null)
            {
                args.Add(new JProperty("tvshowid", tvShowId));
            }
            if (season != null)
            {
                args.Add(new JProperty("season", season));
            }

            if (fields != null)
            {
                args.Add(new JProperty("fields", fields));
            }
            if (sort != null)
            {
                args.Add(sort.ToJObject().Children());
            }

            List <Episode> list  = new List <Episode>();
            JObject        query = (JObject)Client.Invoke("VideoLibrary.GetEpisodes", args);

            if (query["episodes"] != null)
            {
                foreach (JObject item in (JArray)query["episodes"])
                {
                    list.Add(Episode.EpisodeFromJsonObject(item));
                }
            }

            return(list);
        }
Exemplo n.º 7
0
        public List <Artist> GetArtists(SortParams sort)
        {
            var args = new JObject();

            if (sort != null)
            {
                args.Add(sort.ToJObject().Children());
            }

            JObject       query = (JObject)Client.Invoke("AudioLibrary.GetArtists", args);
            List <Artist> list  = new List <Artist>();

            if (query != null)
            {
                foreach (JObject item in (JArray)query["artists"])
                {
                    list.Add(Artist.ArtistFromJsonObject(item));
                }
            }

            return(list);
        }