private static void Main(string[] args) { JsonRpcSerializer serializer = new JsonRpcSerializer(); AsyncHttpClient client = new AsyncHttpClient(serializer); client.BaseUri = new Uri("http://Suffix:8080/jsonrpc"); AudioLibraryClient libraryClient = new AudioLibraryClient(client, serializer); PlayerClient playerClient = new PlayerClient(client, serializer); //XbmcServerClient serverClient = new XbmcServerClient(client); PlaylistClient playlist = new PlaylistClient(client, serializer); FilesClient files = new FilesClient(client, serializer); XbmcPlayer player = new XbmcPlayer { Id = 0 }; //playerClient.PlayPause(ResultAction, player); PlayerProperties props = playerClient.GetProperties(player).Result; IEnumerable<Playlist> playlists = playlist.GetPlaylists().Result; IMediaItemList<MediaDetailsBase> items = playlist.GetItems(playlists.First()).Result; var artists = libraryClient.GetArtists(null, null, ArtistFields.All, 0, 50, SortMethods.Album, Orders.Ascending).Result; var fs = files.GetMusicPlaylists().Result; //player.GetItem(ResultAction); //player.GetProperties(Result); //player.Seek(ResultAction, 10); //library.GetAlbums(ResultAction, 214, null, null, 2, null); //library.GetArtists(ResultAction); //library.GetSongs(ResultAction, null, null, null); //library.GetSong(ResultAction, 6695, null); //library.GetAlbum(ResultAction, 470, null); //library.GetArtist(ResultAction, 215, null); //player.OpenAlbum(ResultAction, 469); //server.Introspect(ResultAction); //server.ToggleMute(ResultAction); //server.Ping(ResultAction); //server.GetVersion(ResultAction); //playlist.Remove(ResultAction, new Playlist { Id = 0 }, 1); //playlist.Add(ResultAction, new Playlist { Id = 0 }, new Album { Id = 470 }); //playlist.GetItems(ResultAction, new Playlist { Id = 0 }); //playlist.GetPlaylists(ResultAction); Console.ReadLine(); }
/// <summary> /// Go to previous item on the playlist /// </summary> public async Task GoPrevious(XbmcPlayer player) { await _client.PostWithoutResultAsync("Player.GoTo", new JsonParam("playerid", player.Id), new JsonParam("to", "previous")); }
/// <summary> /// Retrieves the currently played item /// </summary> public async Task<PlayerProperties> GetProperties(XbmcPlayer player) { return await _client.PostAsync("Player.GetProperties", _jsonRpcSerializer.Parse<PlayerProperties>, new JsonParam("playerid", player.Id), new JsonParam("properties", DefaultPlayerProperties)); }
/// <summary> /// Retrieves the currently played item /// </summary> public async Task<MediaDetailsBase> GetItem(XbmcPlayer player) { return await _client.PostAsync("Player.GetItem", t => _jsonRpcSerializer.Parse<MediaDetailsBase>(t, "item"), new JsonParam("playerid", player.Id), new JsonParam("properties", ItemProperties)); }
/// <summary> /// Zoom out once /// </summary> public async Task ZoomOut(XbmcPlayer player) { await _client.PostWithoutResultAsync("Player.ZoomOut", new JsonParam("playerid", player.Id)); }
/// <summary> /// Zooms current picture /// </summary> /// <param name="zoomLevel">Zoom level (1-10)</param> public async Task Zoom(XbmcPlayer player, int zoomLevel) { await _client.PostWithoutResultAsync("Player.Zoom", new JsonParam("playerid", player.Id), new JsonParam("value", zoomLevel)); }
/// <summary> /// Unshuffle items in the player /// </summary> public async Task ShuffleOff(XbmcPlayer player) { await _client.PostWithoutResultAsync("Player.SetShuffle", new JsonParam("playerid", player.Id), new JsonParam("shuffle", false)); }
/// <summary> /// Pauses or unpause playback and returns the new state /// </summary> public async Task<PlayerSpeed> PlayPauseToggle(XbmcPlayer player) { return await _client.PostAsync("Player.PlayPause", _jsonRpcSerializer.Parse<PlayerSpeed>, new JsonParam("playerid", player.Id)); }
/// <summary> /// Set the speed of the current playback /// </summary> public async Task<PlayerSpeed> SetSpeed(XbmcPlayer player, SpeedNumeric speed) { return await _client.PostAsync("Player.SetSpeed", _jsonRpcSerializer.Parse<PlayerSpeed>, new JsonParam("playerid", player.Id), new JsonParam("speed", speed)); }
/// <summary> /// Set the repeat mode of the player /// </summary> public async Task SetRepeat(XbmcPlayer player, Repeat state) { await _client.PostWithoutResultAsync("Player.SetRepeat", new JsonParam("playerid", player.Id), new JsonParam("repeat", state)); }
/// <summary> /// Set the audio stream played by the player /// </summary> public async Task SetAudioStream(XbmcPlayer player, SetAudioStreamMode stream) { await _client.PostWithoutResultAsync("Player.SetAudioStream", new JsonParam("playerid", player.Id), new JsonParam("stream", stream)); }
/// <summary> /// Seek by predefined jumps /// </summary> public async Task<PlayerPosition> Seek(XbmcPlayer player, SeekJumps seekJump) { return await _client.PostAsync("Player.Seek", _jsonRpcSerializer.Parse<PlayerPosition>, new JsonParam("playerid", player.Id), new JsonParam("value", seekJump)); }
/// <summary> /// Seek through the playing item by percentage /// </summary> public async Task<PlayerPosition> Seek(XbmcPlayer player, decimal percentage) { return await _client.PostAsync("Player.Seek", _jsonRpcSerializer.Parse<PlayerPosition>, new JsonParam("playerid", player.Id), new JsonParam("value", percentage)); }
/// <summary> /// Rotates current picture /// </summary> public async Task Rotate(XbmcPlayer player) { await _client.PostWithoutResultAsync("Player.Rotate", new JsonParam("playerid", player.Id)); }
/// <summary> /// Go to item at the given position in the playlist /// </summary> public async Task GoTo(int position, XbmcPlayer player) { await _client.PostWithoutResultAsync("Player.GoTo", new JsonParam("playerid", player.Id), new JsonParam("to", position)); }
/// <summary> /// If picture is zoomed move viewport right otherwise skip next /// </summary> public async Task MoveRight(XbmcPlayer player) { await _client.PostWithoutResultAsync("Player.Move", new JsonParam("playerid", player.Id), new JsonParam("direction", "right")); }
/// <summary> /// Set the subtitle displayed by the player /// </summary> public async Task SetSubtitle(XbmcPlayer player, SubtitleMode subtitle) { await _client.PostWithoutResultAsync("Player.SetSubtitle", new JsonParam("playerid", player.Id), new JsonParam("subtitle", subtitle)); }