/// <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); }
/// <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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
public override void SeekPercentage(XDataReceived userCallback, double percentage) { throw new InvalidOperationException("This method is only available in the Video and Audio players."); }
/// <summary> /// Gets the current volume. /// </summary> /// <param name="userCallback"></param> public virtual void GetVolume(XDataReceived userCallback) { Client.GetData("XBMC.GetVolume", null, GetVolumeCallback, userCallback); }
public void Ping(XDataReceived userCallback) { mClient.GetData("JSONRPC.Ping", null, PingCallback, userCallback); }
/// <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); }
public override void GetTime(XDataReceived userCallback) { throw new InvalidOperationException("This method is only available in the Video and Audio players."); }
public override void SeekTime(XDataReceived userCallback, int timeInSeconds) { throw new InvalidOperationException("This method is only available in the Video and Audio players."); }
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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }