예제 #1
0
        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();
        }
예제 #2
0
 /// <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"));
 }
예제 #3
0
 /// <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));
 }
예제 #4
0
 /// <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));
 }
예제 #5
0
 /// <summary>
 /// Zoom out once
 /// </summary>
 public async Task ZoomOut(XbmcPlayer player)
 {
     await _client.PostWithoutResultAsync("Player.ZoomOut", new JsonParam("playerid", player.Id));
 }
예제 #6
0
 /// <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));
 }
예제 #7
0
 /// <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));
 }
예제 #8
0
 /// <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));
 }
예제 #9
0
 /// <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));
 }
예제 #10
0
 /// <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));
 }
예제 #11
0
 /// <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));
 }
예제 #12
0
 /// <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));
 }
예제 #13
0
 /// <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));
 }
예제 #14
0
 /// <summary>
 /// Rotates current picture
 /// </summary>
 public async Task Rotate(XbmcPlayer player)
 {
     await _client.PostWithoutResultAsync("Player.Rotate", new JsonParam("playerid", player.Id));
 }
예제 #15
0
 /// <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));
 }
예제 #16
0
 /// <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"));
 }
예제 #17
0
 /// <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));
 }