Ejemplo n.º 1
0
        public ICollection <XbmcSong> GetSongs(XbmcAlbum album, int start, int end, params string[] fields)
        {
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            return(this.getSongs(album.Id, -1, -1, start, end, fields));
        }
Ejemplo n.º 2
0
        private ICollection <XbmcMusicVideo> GetMusicVideos(XbmcAlbum album, int start, int end, params string[] fields)
        {
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            return(this.GetMusicVideos(-1, album.Id, start, end, fields));
        }
Ejemplo n.º 3
0
        private ICollection <XbmcAlbum> getAlbums(int artistId, int genreId, int start, int end, params string[] fields)
        {
            this.client.LogMessage("XbmcAudioLibrary.GetAlbums()");

            JObject args = new JObject();

            if (artistId >= 0)
            {
                args.Add(new JProperty("artistid", artistId));
            }
            if (genreId >= 0)
            {
                args.Add(new JProperty("genreid", genreId));
            }
            if (fields != null && fields.Length > 0)
            {
                string[] fieldCopy = new string[fields.Length + 2];
                fieldCopy[0] = "albumid";
                fieldCopy[1] = "album_artist";
                Array.Copy(fields, 0, fieldCopy, 2, fields.Length);
                args.Add(new JProperty("fields", fieldCopy));
            }
            else
            {
                args.Add(new JProperty("fields", XbmcAlbum.Fields));
            }
            if (start >= 0)
            {
                args.Add(new JProperty("start", start));
            }
            if (end >= 0)
            {
                args.Add(new JProperty("end", end));
            }

            JObject query = this.client.Call("AudioLibrary.GetAlbums", args) as JObject;

            if (query == null || query["albums"] == null)
            {
                this.client.LogErrorMessage("AudioLibrary.GetAlbums(): Invalid response");

                return(null);
            }

            List <XbmcAlbum> albums = new List <XbmcAlbum>();

            foreach (JObject item in (JArray)query["albums"])
            {
                albums.Add(XbmcAlbum.FromJson(item, this.client));
            }

            return(albums);
        }
Ejemplo n.º 4
0
        private ICollection <XbmcMusicVideo> GetMusicVideos(XbmcArtist artist, XbmcAlbum album, params string[] fields)
        {
            if (artist == null)
            {
                throw new ArgumentNullException("artist");
            }
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            return(this.GetMusicVideos(artist.Id, album.Id, -1, -1, fields));
        }
Ejemplo n.º 5
0
        public bool Play(XbmcAlbum album)
        {
            this.client.LogMessage("XbmcGeneral.Play(album)");

            if (album == null)
            {
                throw new ArgumentNullException("album");
            }
            if (album.Id < 0)
            {
                throw new ArgumentException("Invalid album ID");
            }

            JObject args = new JObject();

            args.Add(new JProperty("albumid", album.Id));

            return(this.client.Call("XBMC.Play", args) != null);
        }
Ejemplo n.º 6
0
        public bool Play(XbmcAlbum album)
        {
            this.client.LogMessage("XbmcGeneral.Play(album)");

            if (album == null)
            {
                throw new ArgumentNullException("album");
            }
            if (album.Id < 0)
            {
                throw new ArgumentException("Invalid album ID");
            }

            JObject args = new JObject();
            args.Add(new JProperty("albumid", album.Id));

            return (this.client.Call("XBMC.Play", args) != null);
        }
        public ICollection<XbmcSong> GetSongs(XbmcAlbum album, int start, int end, params string[] fields)
        {
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            return this.getSongs(album.Id, -1, -1, start, end, fields);
        }
Ejemplo n.º 8
0
        private ICollection<XbmcMusicVideo> GetMusicVideos(XbmcAlbum album, int start, int end, params string[] fields)
        {
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            return this.GetMusicVideos(-1, album.Id, start, end, fields);
        }
Ejemplo n.º 9
0
        private ICollection<XbmcMusicVideo> GetMusicVideos(XbmcArtist artist, XbmcAlbum album, params string[] fields)
        {
            if (artist == null)
            {
                throw new ArgumentNullException("artist");
            }
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            return this.GetMusicVideos(artist.Id, album.Id, -1, -1, fields);
        }