Ejemplo n.º 1
0
        /// <summary>
        /// Seek to a position in the track defined by a percentage (of total duration?).
        /// </summary>
        /// <param name="userCallback"></param>
        /// <param name="percentage"></param>
        public virtual void SeekPercentage(XDataReceived userCallback, double percentage)
        {
            var args = new JObject {
                new JProperty("percentage", percentage)
            };

            Client.GetData(string.Format("{0}.SeekPercentage", this.PlayerType().ToString()), args, SeekPercentageCallback, userCallback);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Seek to a position in the track defined by position in seconds.
        /// </summary>
        /// <param name="userCallback"></param>
        /// <param name="timeInSeconds"></param>
        public virtual void SeekTime(XDataReceived userCallback, int timeInSeconds)
        {
            var args = new JObject {
                new JProperty("time", timeInSeconds)
            };

            Client.GetData(string.Format("{0}.SeekTime", this.PlayerType().ToString()), args, SeekTimeCallback, userCallback);
        }
Ejemplo n.º 3
0
        public void GetArtists(SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject();

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

            _Client.GetData("AudioLibrary.GetArtists", args, GetArtistsCallback, userCallback);
        }
Ejemplo n.º 4
0
        public void GetTvShows(SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject {
                new JProperty("fields", _AllTvShowFields)
            };

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

            _Client.GetData("VideoLibrary.GetTvShows", args, GetTvShowsCallback, userCallback);
        }
Ejemplo n.º 5
0
        public void GetSongsByAlbum(int albumId, SortParams sort, XDataReceived userCallback, Action <List <Song> > actionCallback)
        {
            var args = new JObject {
                new JProperty("albumid", albumId), new JProperty("fields", _AllSongFields)
            };

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

            _Client.GetData("AudioLibrary.GetSongs", args, GetSongsCallback, userCallback);
        }
Ejemplo n.º 6
0
        public void GetAlbumsByArtist(int artistId, SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject {
                new JProperty("artistid", artistId), new JProperty("fields", _AllAlbumFields)
            };

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

            _Client.GetData("AudioLibrary.GetAlbums", args, GetAlbumsCallback, userCallback);
        }
Ejemplo n.º 7
0
        public void GetAlbums(SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject();

            args.Add(new JProperty("fields", _AllAlbumFields));

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

            _Client.GetData("AudioLibrary.GetAlbums", args, GetAlbumsCallback, userCallback);
        }
Ejemplo n.º 8
0
        public void GetSeasons(int tvShowId, SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject {
                new JProperty("tvshowid", tvShowId), new JProperty("fields", _AllSeasonFields)
            };

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

            _Client.GetData("VideoLibrary.GetSeasons", args, GetSeasonsCallback, userCallback);
        }
Ejemplo n.º 9
0
        public void GetData(string method, object args, XClientResponseReceived internalCallback, XDataReceived userCallback)
        {
            var requestState = new XRequestState
                                   {
                                       InternalCallback = internalCallback,
                                       UserCallback = userCallback,
                                       JsonRequest = BuildJsonPost(method, args),
                                       Request = (HttpWebRequest) WebRequest.Create(mSettings.XJsonInterfaceAddress),
                                       RequestOperation = method
                                   };

            requestState.Request.Credentials = new NetworkCredential(mSettings.UserName, mSettings.Password);
            requestState.Request.ContentType = "application/json";
            requestState.Request.Method = "POST";
            requestState.Request.BeginGetRequestStream(ResponseStreamReceived, requestState);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Exports the specified export path.
        /// </summary>
        /// <param name="exportPath">The export path.</param>
        /// <param name="includeImages">if set to <c>true</c> [include images].</param>
        /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
        /// <param name="userCallback">The user callback.</param>
        public void Export(string exportPath, bool includeImages, bool overwrite, XDataReceived userCallback)
        {
            //throw new NotImplementedException("Not supported due to JSON complexity");
            var args = new JObject(
                new JProperty("type",
                    new JArray(
                        new JObject(new JProperty("path", exportPath)),
                        new JObject(
                            new JProperty("images", includeImages),
                            new JProperty("overwrite", overwrite)

                            )
                        )
                    )
                );

            //var args = new JObject(
                //new JProperty("type",
                //    new JObject(
                //        new JObject("properties",
                //            new JProperty("path",exportPath)

                //            )

                //        ),
                //    new JObject(
                //         new JObject("properties",
                //             new JProperty("images", includeImages),
                //             new JProperty("overwrite", overwrite)

                //        )

                //    )
                //));
            /*var args = new JObject(new JProperty("properties",
                    new JArray(
                    new JObject(new JProperty("path", exportPath)),
                    new JObject(new JProperty("images", includeImages)),
                    new JObject(new JProperty("overwrite", overwrite)))));*/

            mClient.GetData("AudioLibrary.Export", args, ExportCallback, userCallback);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Gets a percentage, of what is not obviously documented, presumably Position/Duration*100.
 /// </summary>
 /// <param name="userCallback"></param>
 public virtual void GetPercentage(XDataReceived userCallback)
 {
     Client.GetData(string.Format("{0}.GetPercentage", this.PlayerType().ToString()), null, GetPercentageCallback, userCallback);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Gets the songs by genre.
        /// </summary>
        /// <param name="genreId">The genre id.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="userCallback">The user callback.</param>
        public void GetSongsByGenre(int genreId, SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject { new JProperty("genreid",genreId), new JProperty(_propType, Types.Audio.Fields.Song.Get()) };

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

            mClient.GetData("AudioLibrary.GetSongs", args, GetSongsCallback, userCallback);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Cleans the audio library of non existent items.
 /// </summary>
 /// <param name="userCallback">The user callback.</param>
 public void Clean(XDataReceived userCallback)
 {
     mClient.GetData("AudioLibrary.Clean", null, CleanCallback, userCallback);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Cleans the audio library of non existent items.
 /// </summary>
 /// <param name="userCallback">The user callback.</param>
 public void Clean(XDataReceived userCallback)
 {
     mClient.GetData(SetMethod(VideoLibrary.Clean), null, VideoLibraryCallbackManager, userCallback);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Seek to a position in the track defined by position in seconds.
        /// </summary>
        /// <param name="userCallback"></param>
        /// <param name="timeInSeconds"></param>
        public virtual void SeekTime(XDataReceived userCallback, int timeInSeconds)
        {
            var args = new JObject { new JProperty("time", timeInSeconds) };

             Client.GetData(string.Format("{0}.SeekTime", this.PlayerType().ToString()), args, SeekTimeCallback, userCallback);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Gets the music video details.
 /// </summary>
 /// <param name="videoId">The video id.</param>
 /// <param name="userCallback">The user callback.</param>
 public void GetMusicVideoDetails(int videoId, XDataReceived userCallback)
 {
     var args = new JObject { new JProperty("musicvideoid", videoId), new JProperty(mPropType, Types.Video.Fields.MusicVideo.Get()) };
     mClient.GetData(SetMethod(VideoLibrary.GetMusicVideoDetails), args, VideoLibraryCallbackManager, userCallback);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Gets the tv show details.
 /// </summary>
 /// <param name="tvShowId">The tv show id.</param>
 /// <param name="userCallback">The user callback.</param>
 public void GetTvShowDetails(int tvShowId, XDataReceived userCallback)
 {
     var args = new JObject { new JProperty("tvshowid", tvShowId), new JProperty(mPropType, Types.Video.Fields.TVShow.Get()) };
     mClient.GetData(SetMethod(VideoLibrary.GetTVShowDetails), args, VideoLibraryCallbackManager, userCallback);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Introspects returns the full json schema. 
 /// </summary>
 /// <param name="userCallback">The user callback.</param>
 public void Introspect(XDataReceived userCallback)
 {
     //var args = new JObject { new JProperty("volume", message), new JProperty("level", level.ToString()) };
     mClient.GetData("JSONRPC.Introspect", null, IntrospectCallback, userCallback);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Gets the state of the audio player, including time information, to the millisecond.
 /// </summary>
 /// <param name="userCallback"></param>
 public virtual void GetTime(XDataReceived userCallback)
 {
     Client.GetData(string.Format("{0}.Forward", this.PlayerType().ToString()), null, GetTimeCallback, userCallback);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Notifies the specified sender.
 /// Callback not really required...?
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="message">The message.</param>
 /// <param name="userCallback">The user callback.</param>
 public void NotifyAll(string sender, string message, XDataReceived userCallback)
 {
     var args = new JObject { new JProperty("sender", sender), new JProperty("message", message) };
     mClient.GetData("JSONRPC.NotifyAll", args, NotifyCallback, userCallback);
 }
Ejemplo n.º 21
0
 public override void SeekPercentage(XDataReceived userCallback, double percentage)
 {
     throw new InvalidOperationException("This method is only available in the Video and Audio players.");
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Gets the current volume.
 /// </summary>
 /// <param name="userCallback"></param>
 public virtual void GetVolume(XDataReceived userCallback)
 {
     Client.GetData("XBMC.GetVolume", null, GetVolumeCallback, userCallback);
 }
Ejemplo n.º 23
0
 public void Ping(XDataReceived userCallback)
 {
     mClient.GetData("JSONRPC.Ping", null, PingCallback, userCallback);
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Gets the status (active/inactive) of the Video, Audio and Picture players.
        /// 
        /// Only one player can be active at one time, so this method will return a XPlayerType.
        /// </summary>
        public void GetActivePlayers(XDataReceived userCallback)
        {
            var args = new JObject { new JProperty("properties", new[] { "playerid", "type" }) };

              Client.GetData("Player.GetActivePlayers", null, GetActivePlayersCallback, userCallback);
        }
Ejemplo n.º 25
0
 public override void SeekPercentage(XDataReceived userCallback, double percentage)
 {
     throw new InvalidOperationException("This method is only available in the Video and Audio players.");
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Gets the current volume.
 /// </summary>
 /// <param name="userCallback"></param>
 public virtual void GetVolume(XDataReceived userCallback)
 {
     Client.GetData("XBMC.GetVolume", null, GetVolumeCallback, userCallback);
 }
Ejemplo n.º 27
0
 public override void GetTime(XDataReceived userCallback)
 {
     throw new InvalidOperationException("This method is only available in the Video and Audio players.");
 }
Ejemplo n.º 28
0
 public override void SeekTime(XDataReceived userCallback, int timeInSeconds)
 {
     throw new InvalidOperationException("This method is only available in the Video and Audio players.");
 }
Ejemplo n.º 29
0
        public void GetData(string method, object args, XClientResponseReceived internalCallback, XDataReceived userCallback)
        {
            var requestState = new XRequestState
            {
                InternalCallback = internalCallback,
                UserCallback     = userCallback,
                JsonRequest      = BuildJsonPost(method, args),
                Request          = (HttpWebRequest)WebRequest.Create(_Settings.XJsonInterfaceAddress)
            };

            requestState.Request.Credentials = new NetworkCredential(_Settings.UserName, _Settings.Password);
            requestState.Request.ContentType = "application/json";
            requestState.Request.Method      = "POST";
            requestState.Request.BeginGetRequestStream(ResponseStreamReceived, requestState);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Gets the album details.
 /// Returns Album to usercallback
 /// </summary>
 /// <param name="albumId">The album id.</param>
 /// <param name="userCallback">The user callback.</param>
 public void GetAlbumDetails(int albumId, XDataReceived userCallback)
 {
     var args = new JObject { new JProperty("albumid", albumId), new JProperty(_propType, Types.Audio.Fields.Album.Get()) };
     mClient.GetData("AudioLibrary.GetAlbumDetails", args, GetAlbumDetailsCallback, userCallback);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Gets the artist details.
 /// returns an Artist object to the user callback
 /// </summary>
 /// <param name="artistId">The artist id.</param>
 /// <param name="userCallback">The user callback.</param>
 public void GetArtistDetails(int artistId, XDataReceived userCallback)
 {
     var args = new JObject { new JProperty("artistid", artistId), new JProperty(_propType, Types.Audio.Fields.Artist.Get()) };
     //throw new NotImplementedException("API returns invalid parameters for this method");
     //var args = new JObject { new JProperty("artistid", artistId), new JProperty(_propType, Artist.PropertyFields) };
     mClient.GetData("AudioLibrary.GetArtistDetails", args, GetArtistDetailsCallback, userCallback);
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Gets the artists.
        /// </summary>
        /// <param name="sort">The sort.</param>
        /// <param name="userCallback">The user callback.</param>
        public void GetArtists(SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject();

            args.Add(new JProperty(_propType, Types.Audio.Fields.Artist.Get()));

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

            mClient.GetData("AudioLibrary.GetArtists", args, GetArtistsCallback, userCallback);
        }
Ejemplo n.º 33
0
 /// <summary>
 /// Gets the episode details.
 /// </summary>
 /// <param name="episodeId">The episode id.</param>
 /// <param name="userCallback">The user callback.</param>
 public void GetEpisodeDetails(int episodeId, XDataReceived userCallback)
 {
     var args = new JObject { new JProperty("episodeid", episodeId), new JProperty(mPropType, Types.Video.Fields.Episode.Get()) };
     mClient.GetData(SetMethod(VideoLibrary.GetEpisodeDetails), args, VideoLibraryCallbackManager, userCallback);
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Gets the genres.
        /// </summary>
        /// <param name="userCallback">The user callback.</param>
        public void GetGenres(XDataReceived userCallback)
        {
            var args = new JObject();

            args.Add(new JProperty(_propType, xbmc_json_async.Types.Library.Fields.Genre.Get()));

            mClient.GetData("AudioLibrary.GetGenres", args, GetGenresCallback, userCallback);
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Gets the seasons.
        /// </summary>
        /// <param name="tvShowId">The tv show id.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="userCallback">The user callback.</param>
        public void GetSeasons(int tvShowId, SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject { new JProperty("tvshowid", tvShowId), new JProperty(mPropType, Types.Video.Fields.Season.Get()) };

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

            mClient.GetData(SetMethod(VideoLibrary.GetSeasons), args, VideoLibraryCallbackManager, userCallback);
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Gets the recently added albums.
        /// </summary>
        /// <param name="sort">The sort.</param>
        /// <param name="userCallback">The user callback.</param>
        public void GetRecentlyAddedAlbums(SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject { new JProperty(_propType, Types.Audio.Fields.Album.Get()) };

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

            mClient.GetData("AudioLibrary.GetRecentlyAddedAlbums", args, GetAlbumsCallback, userCallback);
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Gets the tv shows.
        /// </summary>
        /// <param name="sort">The sort.</param>
        /// <param name="userCallback">The user callback.</param>
        public void GetTvShows(SortParams sort, XDataReceived userCallback)
        {
            var args = new JObject {new JProperty(mPropType, Types.Video.Fields.TVShow.Get())};

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

            mClient.GetData(SetMethod(VideoLibrary.GetTVShows), args, VideoLibraryCallbackManager, userCallback);
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Gets the songs by album.
        /// </summary>
        /// <param name="albumId">The album id.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="userCallback">The user callback.</param>
        /// <param name="actionCallback">The action callback.</param>
        public void GetSongsByAlbum(int albumId, SortParams sort, XDataReceived userCallback, Action<List<Song>> actionCallback)
        {
            var args = new JObject { new JProperty("albumid", albumId), new JProperty(_propType, Types.Audio.Fields.Song.Get()) };

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

            mClient.GetData("AudioLibrary.GetSongs", args, GetSongsCallback, userCallback);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Gets Properties from XBMC - volume, muted (boolean), name, version
        /// </summary>
        public void GetProperties(XDataReceived userCallback,String[] propertyName)
        {
            var args = new JObject { new JProperty("properties", propertyName) };

            Client.GetData("Application.GetProperties", args, GetPropertiesCallback, userCallback);
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Seek to a position in the track defined by a percentage (of total duration?).
        /// </summary>
        /// <param name="userCallback"></param>
        /// <param name="percentage"></param>
        public virtual void SeekPercentage(XDataReceived userCallback, double percentage)
        {
            var args = new JObject { new JProperty("percentage", percentage) };

             Client.GetData(string.Format("{0}.SeekPercentage", this.PlayerType().ToString()), args, SeekPercentageCallback, userCallback);
        }