diff --git a/Views/MainWindow.xaml.cs b/Views/MainWindow.xaml.cs index bee00c7..332f606 100644 --- a/Views/MainWindow.xaml.cs +++ b/Views/MainWindow.xaml.cs @@ -6,6 +6,8 @@ using System.Windows.Threading; using System.Windows.Interop; using System.Windows.Input; using System.Windows.Controls.Primitives; +using MpcNET.Commands.Queue; +using System.Diagnostics; namespace unison { @@ -61,9 +63,11 @@ namespace unison } _settingsWin.UpdateConnectionStatus(); Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}"; + + _shuffleWin.ListGenre(); } - public void OnSongChanged(object sender, EventArgs e) + public async void OnSongChanged(object sender, EventArgs e) { if (_mpd.GetCurrentSong() == null) return; @@ -109,6 +113,32 @@ namespace unison _timer.Start(); EndTime.Text = FormatSeconds(_mpd.GetCurrentSong().Time); } + + Debug.WriteLine("Song changed called!"); + + // handle continuous shuffle + if (_shuffleWin.GetContinuous()) + { + System.Collections.Generic.IEnumerable a = await _mpd.SafelySendCommandAsync(new PlaylistCommand()); + int queueSize = 0; + foreach (var i in a) + { + Debug.WriteLine(i.Path); + queueSize++; + } + Debug.WriteLine("queue size is: " + queueSize); + + if (queueSize < 5) + { + _shuffleWin.AddContinuousSongs(); + } + + // query queue + // if (queue.SongRemaining < 5) + //{ + // // query shuffle songs + //} + } } public void OnStatusChanged(object sender, EventArgs e) diff --git a/Views/Settings.xaml b/Views/Settings.xaml index e498f59..3e8c797 100644 --- a/Views/Settings.xaml +++ b/Views/Settings.xaml @@ -44,59 +44,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -