コード例 #1
0
        private async Task Check_Queue_HasSongs(int nrOfSongs)
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.GetAllSongsInfo());

            Assert.IsTrue(message.HasSuccessResponse());
            Assert.IsTrue(message.Response.Body.Count() == nrOfSongs);
        }
コード例 #2
0
        private async Task Check_Queue_HasSongs(int nrOfSongs)
        {
            var message = await Mpc.SendAsync(new Commands.Playlist.PlaylistCommand());

            Assert.IsTrue(message.HasSuccessResponse());
            Assert.IsTrue(message.Response.Content.Count() == nrOfSongs);
        }
コード例 #3
0
        private async Task Check_Empty_Queue()
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.GetAllSongsInfo());

            Assert.IsTrue(message.HasSuccessResponse());
            Assert.IsFalse(message.Response.Body.Any());
        }
コード例 #4
0
 private void LoadMpc(byte[] buf, ref int offset)
 {
     offset = 192;
     for (var k = 0; k < 255; k++)
     {
         var mpcFileName = new byte[32];
         var i           = 0;
         for (; buf[offset + i] != 0; i++)
         {
             mpcFileName[i] = buf[offset + i];
         }
         if (i == 0)
         {
             _mpcList.Add(null);
         }
         else
         {
             var mpc = new Mpc(
                 _mpcDirPath + "\\" +
                 Globals.LocalEncoding.GetString(mpcFileName, 0, i));
             _mpcList.Add(mpc);
             if (buf[offset + 36] == 1)
             {
                 _loopingList.Add(mpc);
             }
         }
         offset += 64;
     }
     offset = 16512;
 }
コード例 #5
0
        private async Task Check_Empty_Queue()
        {
            var message = await Mpc.SendAsync(new Commands.Playlist.PlaylistCommand());

            Assert.IsTrue(message.HasSuccessResponse());
            Assert.IsFalse(message.Response.Content.Any());
        }
コード例 #6
0
ファイル: OutputCommandsTest.cs プロジェクト: hugener/MpcNET
        public async Task LisOutputsTest()
        {
            var response = await Mpc.SendAsync(new Commands.Output.OutputsCommand());

            TestOutput.WriteLine("LisOutputsTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Content.Count().Equals(3));
        }
コード例 #7
0
        public async Task TagTypesTest()
        {
            var response = await Mpc.SendAsync(new Commands.Reflection.TagTypes());

            TestOutput.WriteLine("TagTypesTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Count().Equals(17));
        }
コード例 #8
0
        public async Task ListPlaylistsTest()
        {
            var response = await Mpc.SendAsync(Commands.Playlists.Stored.GetAll());

            TestOutput.WriteLine($"ListPlaylistsTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Count().Equals(3));
        }
コード例 #9
0
        public async Task ListAllTest()
        {
            var response = await Mpc.SendAsync(new Commands.Database.ListAll());

            TestOutput.WriteLine("ListAllTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Count().Equals(7));
        }
コード例 #10
0
        public async Task FindGenreTest()
        {
            var response = await Mpc.SendAsync(new Commands.Database.Find(MpdTags.Genre, "soundfx"));

            TestOutput.WriteLine("FindGenreTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Count().Equals(7));
        }
コード例 #11
0
        public async Task ListPlaylistTest(string playlistName, int numberOfFiles)
        {
            var response = await Mpc.SendAsync(Commands.Playlists.Stored.GetContent(playlistName));

            TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Count().Equals(numberOfFiles));
        }
コード例 #12
0
ファイル: MpcMock.cs プロジェクト: yn-cloud/MpcNET
        public MpcMock()
        {
            var mpdEndpoint = new IPEndPoint(IPAddress.Loopback, 6600);

            Client = new Mpc(mpdEndpoint);

            var connected = Task.Run(async() => await Client.ConnectAsync()).Result;

            TestOutput.WriteLine($"Connected to MPD : {connected}; Version: {Client.Version}");
        }
コード例 #13
0
ファイル: MainWindow.cs プロジェクト: renstanford/mLedMatrix
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        entry_address.ModifyBase(StateType.Normal, new Gdk.Color(255, 0, 0));
        led_matrix        = new LedMatrix("0.0.0.0");
        led_matrix_thread = new Thread(led_matrix.Runner);
        winamp            = new Winamp_httpQ();
        rss          = new RssPlugin();
        no_tray_icon = false;
        IPEndPoint mpc_endpoint;

        led_matrix.rss = rss;
        mpc_plugin     = new Mpc();

        mpd_timer          = new System.Timers.Timer();
        mpd_timer.Elapsed += new ElapsedEventHandler(mpd_timer_elapsed);
        mpd_timer.Interval = 1000;         //1s
        mpd_timer.Start();

        try
        {
            tray_icon = new StatusIcon(new Gdk.Pixbuf("icon.png"));
        }
        catch (Exception)
        {
            no_tray_icon = true;
        }
        if (no_tray_icon == false)
        {
            tray_icon.Visible   = true;
            tray_icon.Tooltip   = "LedMatrix Control";
            tray_icon.Activate += delegate { this.Visible = !this.Visible; };
        }


        loadConfig();
        led_matrix.connection_status_changed_handler += led_matrix_connection_changed;
        led_matrix_thread.Start();
        winamp.title_changed_handler      += led_matrix.setWinampPlaylisttitle;
        winamp.connection_changed_handler += winamp_connection_changed;
        try
        {
            //mpc_endpoint = new IPEndPoint(Dns.GetHostAddresses("dockstar-bo-hdd")[0], 6600);
            mpc_endpoint                      = new IPEndPoint(Dns.GetHostAddresses(entry_mpd.Text)[0], 6600);
            mpc_con                           = new MpcConnection(mpc_endpoint);
            mpc_plugin.Connection             = mpc_con;
            mpc_plugin.Connection.AutoConnect = true;
        }
        catch (Exception)
        {
        }
        user_lines_table = new userLinesTable(ref treeview2, ref led_matrix);
    }
コード例 #14
0
        public async Task ListPlaylistInfoTest(string playlistName, int numberOfFiles)
        {
            var response = await Mpc.SendAsync(Commands.Playlists.Stored.GetContentWithMetadata(playlistName));

            TestOutput.WriteLine($"ListPlaylistTest (playlistName: {playlistName}) Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Count().Equals(numberOfFiles));
            Assert.IsTrue(response.Response.Body.All(item => !string.IsNullOrEmpty(item.Artist)));
            Assert.IsTrue(response.Response.Body.All(item => !string.IsNullOrEmpty(item.Title)));
            Assert.IsTrue(response.Response.Body.All(item => !string.IsNullOrEmpty(item.Date)));
        }
コード例 #15
0
        public async Task UrlHandlersTest()
        {
            var response = await Mpc.SendAsync(new Commands.Reflection.UrlHandlers());

            TestOutput.WriteLine($"UrlHandlersTest (handlers: {response.Response.Body.Count()}) Result:");
            TestOutput.WriteLine(response);

            // Different answer from MPD on Windows and on Linux.
            // Check some of the handlers.
            Assert.IsTrue(response.Response.Body.Any(handler => handler.Equals("http://")));
            Assert.IsTrue(response.Response.Body.Any(handler => handler.Equals("mms://")));
            Assert.IsTrue(response.Response.Body.Any(handler => handler.Equals("gopher://")));
            Assert.IsTrue(response.Response.Body.Any(handler => handler.Equals("rtp://")));
        }
コード例 #16
0
        public async Task CommandsTest()
        {
            var response = await Mpc.SendAsync(new Commands.Reflection.Commands());

            TestOutput.WriteLine($"CommandsTest (commands: {response.Response.Body.Count()}) Result:");
            TestOutput.WriteLine(response);

            // Different answer from MPD on Windows and on Linux, beacuse of Version.
            // Check some of the commands.
            Assert.IsTrue(response.Response.Body.Any(command => command.Equals("listall")));
            Assert.IsTrue(response.Response.Body.Any(command => command.Equals("outputs")));
            Assert.IsTrue(response.Response.Body.Any(command => command.Equals("pause")));
            Assert.IsTrue(response.Response.Body.Any(command => command.Equals("play")));
            Assert.IsTrue(response.Response.Body.Any(command => command.Equals("setvol")));
            Assert.IsTrue(response.Response.Body.Any(command => command.Equals("stop")));
        }
コード例 #17
0
        public async Task ToggleOutputTest()
        {
            var responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());

            Assert.IsTrue(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);

            var response = await Mpc.SendAsync(new Commands.Output.ToggleOutput(2));

            TestOutput.WriteLine("ToggleOutputTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Body.Equals(string.Empty));
            Assert.IsTrue(response.Response.State.Status.Equals("OK"));

            responseOutputs = await Mpc.SendAsync(new Commands.Output.Outputs());

            Assert.IsFalse(responseOutputs.Response.Body.Single(output => output.Id.Equals(2)).IsEnabled);
        }
コード例 #18
0
ファイル: OutputCommandsTest.cs プロジェクト: hugener/MpcNET
        public async Task DisableOutputTest()
        {
            var responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());

            Assert.IsTrue(responseOutputs.Response.Content.Single(output => output.Id.Equals(0)).IsEnabled);

            var response = await Mpc.SendAsync(new Commands.Output.DisableOutputCommand(0));

            TestOutput.WriteLine("DisableOutputTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Content.Equals(string.Empty));
            Assert.IsTrue(response.Response.Result.Status.Equals("OK"));

            responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());

            Assert.IsFalse(responseOutputs.Response.Content.Single(output => output.Id.Equals(0)).IsEnabled);
        }
コード例 #19
0
ファイル: OutputCommandsTest.cs プロジェクト: hugener/MpcNET
        public async Task EnableOutputTest()
        {
            var responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());

            // By default should be disable from mpd.config
            Assert.IsFalse(responseOutputs.Response.Content.Single(output => output.Id.Equals(1)).IsEnabled);

            var response = await Mpc.SendAsync(new Commands.Output.EnableOutputCommand(1));

            TestOutput.WriteLine("EnableOutputTest Result:");
            TestOutput.WriteLine(response);

            Assert.IsTrue(response.Response.Content.Equals(string.Empty));
            Assert.IsTrue(response.Response.Result.Status.Equals("OK"));

            responseOutputs = await Mpc.SendAsync(new Commands.Output.OutputsCommand());

            Assert.IsTrue(responseOutputs.Response.Content.Single(output => output.Id.Equals(1)).IsEnabled);
        }
コード例 #20
0
        public async Task DecodersTest()
        {
            var response = await Mpc.SendAsync(new Commands.Reflection.Decoders());

            TestOutput.WriteLine($"DecodersTest (decoders: {response.Response.Body.Count()}) Result:");
            TestOutput.WriteLine(response);

            // Different answer from MPD on Windows and on Linux.
            // Check some of the decoders.
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Name.Equals("mad")));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("mp3"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/mpeg"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Name.Equals("flac")));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("flac"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/flac"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/x-flac"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Name.Equals("ffmpeg")));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("aac"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("mpeg"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/aac"))));
            Assert.IsTrue(response.Response.Body.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/mpeg"))));
        }
コード例 #21
0
        private async Task <int> Get_Song_Id()
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.GetAllSongMetadata());

            return(message.Response.Body.Single().Id);
        }
コード例 #22
0
        private async Task Load_Playlist(string playlistName)
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Stored.Load(playlistName));

            Assert.IsTrue(message.HasSuccessResponse());
        }
コード例 #23
0
        private async Task Clear_Queue()
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.Clear());

            Assert.IsTrue(message.HasSuccessResponse());
        }
コード例 #24
0
 /// <summary>Serves as the default hash function. </summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     return(((Mpc?.GetHashCode() ?? 0) * 397) ^ ((CertificateThumbprint?.GetHashCode() ?? 0) * 13) ^ Allowed.GetHashCode());
 }
コード例 #25
0
        private async Task Add_Directory(string directory)
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.AddDirectory(directory));

            Assert.IsTrue(message.HasSuccessResponse());
        }
コード例 #26
0
        private async Task Add_File(string file)
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.AddSong(file));

            Assert.IsTrue(message.HasSuccessResponse());
        }
コード例 #27
0
        private async Task Remove_Position(int position)
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.RemoveSongByPosition(position));

            Assert.IsTrue(message.HasSuccessResponse());
        }
コード例 #28
0
 public MPDService()
 {
     MpdClient = new Mpc();
 }
コード例 #29
0
 //private Libmpc.Mpc = new
 public MpdAccess()
 {
     _mpc = new Libmpc.Mpc();
 }
コード例 #30
0
        private async Task Remove_Id(int songId)
        {
            var message = await Mpc.SendAsync(Commands.Playlists.Current.RemoveSongById(songId));

            Assert.IsTrue(message.HasSuccessResponse());
        }