From 0024325f4f590adc4a4aabfaa29e6cd37feb1471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=BCller?= Date: Sun, 9 Oct 2022 16:59:48 +0200 Subject: [PATCH] - fixed PlayNow issue --- TomatenMusicCore/Music/Entitites/SpotifyPlaylist.cs | 4 +++- TomatenMusicCore/Music/Entitites/TomatenMusicTrack.cs | 2 +- TomatenMusicCore/Music/Entitites/YoutubePlaylist.cs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/TomatenMusicCore/Music/Entitites/SpotifyPlaylist.cs b/TomatenMusicCore/Music/Entitites/SpotifyPlaylist.cs index c2296c0..59a5b26 100644 --- a/TomatenMusicCore/Music/Entitites/SpotifyPlaylist.cs +++ b/TomatenMusicCore/Music/Entitites/SpotifyPlaylist.cs @@ -44,7 +44,9 @@ namespace TomatenMusic.Music.Entitites if (!player.PlayerQueue.Queue.Any()) player.PlayerQueue.CurrentPlaylist = this; - player.PlayerQueue.Queue = new Queue(player.PlayerQueue.Queue.Prepend(new TomatenMusicTrack(player.PlayerQueue.LastTrack.WithPosition(player.TrackPosition)))); + if (!withoutQueuePrepend && player.State == PlayerState.Playing) + player.PlayerQueue.Queue = new Queue(player.PlayerQueue.Queue.Prepend(new TomatenMusicTrack(player.PlayerQueue.LastTrack.WithPosition(player.TrackPosition)))); + Queue reversedTracks = new Queue(Tracks); diff --git a/TomatenMusicCore/Music/Entitites/TomatenMusicTrack.cs b/TomatenMusicCore/Music/Entitites/TomatenMusicTrack.cs index 658e0a6..04bc5e3 100644 --- a/TomatenMusicCore/Music/Entitites/TomatenMusicTrack.cs +++ b/TomatenMusicCore/Music/Entitites/TomatenMusicTrack.cs @@ -38,7 +38,7 @@ namespace TomatenMusicCore.Music.Entities public async Task PlayNow(GuildPlayer player, TimeSpan? startTime = null, TimeSpan? endTime = null, bool withoutQueuePrepend = false) { - if (!withoutQueuePrepend) + if (!withoutQueuePrepend && player.State == PlayerState.Playing) player.PlayerQueue.Queue = new Queue(player.PlayerQueue.Queue.Prepend(new TomatenMusicTrack(player.PlayerQueue.LastTrack.WithPosition(player.TrackPosition)))); diff --git a/TomatenMusicCore/Music/Entitites/YoutubePlaylist.cs b/TomatenMusicCore/Music/Entitites/YoutubePlaylist.cs index 641a21e..0da7007 100644 --- a/TomatenMusicCore/Music/Entitites/YoutubePlaylist.cs +++ b/TomatenMusicCore/Music/Entitites/YoutubePlaylist.cs @@ -57,7 +57,9 @@ namespace TomatenMusic.Music.Entitites if (!player.PlayerQueue.Queue.Any()) player.PlayerQueue.CurrentPlaylist = this; - player.PlayerQueue.Queue = new Queue(player.PlayerQueue.Queue.Prepend(new TomatenMusicTrack(player.PlayerQueue.LastTrack.WithPosition(player.TrackPosition)))); + if (!withoutQueuePrepend && player.State == PlayerState.Playing) + player.PlayerQueue.Queue = new Queue(player.PlayerQueue.Queue.Prepend(new TomatenMusicTrack(player.PlayerQueue.LastTrack.WithPosition(player.TrackPosition)))); + Queue reversedTracks = new Queue(Tracks);