diff --git a/Opus/Code/Api/Services/MusicPlayer.cs b/Opus/Code/Api/Services/MusicPlayer.cs index e4629cd..89aad95 100644 --- a/Opus/Code/Api/Services/MusicPlayer.cs +++ b/Opus/Code/Api/Services/MusicPlayer.cs @@ -464,6 +464,7 @@ namespace Opus.Api.Services Queue.instance?.Refresh(); Player.instance?.RefreshPlayer(); currentID = 0; + SongParser.Cancel(0); await new SongParser().ParseSong(song, 0, true); } else diff --git a/Opus/Code/Api/SongParser.cs b/Opus/Code/Api/SongParser.cs index 9010bef..f19ae88 100644 --- a/Opus/Code/Api/SongParser.cs +++ b/Opus/Code/Api/SongParser.cs @@ -251,6 +251,15 @@ namespace Opus.Api return song; } + /// + /// Will stop the parsing for a slot of the queue. Use this when the user wants to play something else before the end of a parsing (Want to play something on the same queue slot but not the same song has the one being parsed now). + /// + /// + public static void Cancel(int queuePosition) + { + instances.Where(x => x.queuePosition == queuePosition).FirstOrDefault()?.Cancel(); + } + /// /// This method will remove playback calls and get requests from the ///