diff --git a/Handlers/ShuffleHandler.cs b/Handlers/ShuffleHandler.cs index c1838c6..b2ad053 100644 --- a/Handlers/ShuffleHandler.cs +++ b/Handlers/ShuffleHandler.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using System.Windows; @@ -34,8 +35,9 @@ namespace unison SongList.Clear(); - int song = _mpd.GetStats().Songs; - IEnumerable response = await _mpd.SafelySendCommandAsync(new SearchCommand(filter, 0, song + 1)); + int songTotal = _mpd.GetStats().Songs; + + IEnumerable response = await _mpd.SafelySendCommandAsync(new SearchCommand(filter, 0, songTotal + 1)); foreach (IMpdFile file in response) SongList.Add(file.Path); } @@ -45,7 +47,7 @@ namespace unison if (token.IsCancellationRequested) return; - int AddedSongs = 0; + int addedSongs = 0; var commandList = new CommandList(); int songTotal = _mpd.GetStats().Songs; @@ -54,13 +56,13 @@ namespace unison { int song = new Random().Next(0, songTotal - 1); commandList.Add(new SearchAddCommand(new FilterTag(MpdTags.Title, "", FilterOperator.Contains), song, song + 1)); - AddedSongs++; - - // play if stopped or unknown state (no queue managing at the moment, so mandatory) - if (i == 0 && (_mpd.GetStatus().State != MpdState.Play && _mpd.GetStatus().State != MpdState.Pause)) - commandList.Add(new PlayCommand(0)); + addedSongs++; } + // play if stopped or unknown state (no queue managing at the moment, so mandatory) + if ((_mpd.GetStatus().State != MpdState.Play && _mpd.GetStatus().State != MpdState.Pause)) + commandList.Add(new PlayCommand(0)); + await _mpd.SafelySendCommandAsync(commandList); } diff --git a/LICENSE b/LICENSE index b4887d3..4f86246 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -MIT License Copyright (c) 2023 Théo Marchal +MIT License Copyright (c) 2025 Théo Marchal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/Resources/Resources.Designer.cs b/Resources/Resources.Designer.cs index fe21247..5644724 100644 --- a/Resources/Resources.Designer.cs +++ b/Resources/Resources.Designer.cs @@ -60,6 +60,15 @@ namespace unison.Resources { } } + /// + /// Looks up a localized string similar to Clear queue. + /// + public static string Clear_Queue { + get { + return ResourceManager.GetString("Clear_Queue", resourceCulture); + } + } + /// /// Looks up a localized string similar to Database. /// @@ -213,6 +222,24 @@ namespace unison.Resources { } } + /// + /// Looks up a localized string similar to Play queue. + /// + public static string Play_Queue { + get { + return ResourceManager.GetString("Play_Queue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Queue management. + /// + public static string Queue_Management { + get { + return ResourceManager.GetString("Queue_Management", resourceCulture); + } + } + /// /// Looks up a localized string similar to Country. /// diff --git a/Resources/Resources.es-ES.resx b/Resources/Resources.es-ES.resx index b0b9d0d..896d157 100644 --- a/Resources/Resources.es-ES.resx +++ b/Resources/Resources.es-ES.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Borrar cola + Base de datos @@ -168,6 +171,12 @@ no es + + Reproducir cola + + + Gestión de cola + Radios diff --git a/Resources/Resources.fr-FR.resx b/Resources/Resources.fr-FR.resx index 892512d..8dcf0e0 100644 --- a/Resources/Resources.fr-FR.resx +++ b/Resources/Resources.fr-FR.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Effacer la file + Base de donnée @@ -168,6 +171,12 @@ n'est pas + + Jouer la file + + + Gestion de file + Radios diff --git a/Resources/Resources.resx b/Resources/Resources.resx index d0b88ce..bacc7cf 100644 --- a/Resources/Resources.resx +++ b/Resources/Resources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Clear queue + Database @@ -168,6 +171,12 @@ is not + + Play queue + + + Queue management + Radios diff --git a/Views/Shuffle.xaml b/Views/Shuffle.xaml index 310cd0d..365ef20 100644 --- a/Views/Shuffle.xaml +++ b/Views/Shuffle.xaml @@ -81,7 +81,7 @@ - + @@ -96,6 +96,11 @@ + + +