From fa9aa36c946a03d2778ca2f397ed289a8860e3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=BCller?= Date: Tue, 29 Mar 2022 22:34:01 +0200 Subject: [PATCH] fix history always showing same track when using autoplay fix tracks in history still having timestamps --- TomatenMusicCore/Music/GuildPlayer.cs | 3 ++- TomatenMusicCore/Music/PlayerQueue.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TomatenMusicCore/Music/GuildPlayer.cs b/TomatenMusicCore/Music/GuildPlayer.cs index f0510ea..d90147e 100644 --- a/TomatenMusicCore/Music/GuildPlayer.cs +++ b/TomatenMusicCore/Music/GuildPlayer.cs @@ -109,7 +109,7 @@ namespace TomatenMusic.Music MusicActionResponse response; try { - response = PlayerQueue.NextTrack(true); + response = PlayerQueue.(true); }catch (Exception ex) { if (Autoplay) @@ -249,6 +249,7 @@ namespace TomatenMusic.Music TomatenMusicTrack newTrack = await youtube.GetRelatedTrackAsync(oldTrack.TrackIdentifier, PlayerQueue.PlayedTracks.Take(5).ToList().ConvertAll(x => x.TrackIdentifier)); _logger.LogInformation($"Autoplaying for track {oldTrack.TrackIdentifier} with Track {newTrack.TrackIdentifier}"); await base.OnTrackEndAsync(eventArgs); + PlayerQueue.LastTrack = newTrack; await newTrack.Play(this); QueuePrompt.UpdateFor(GuildId); diff --git a/TomatenMusicCore/Music/PlayerQueue.cs b/TomatenMusicCore/Music/PlayerQueue.cs index b705f8a..b8ca3cf 100644 --- a/TomatenMusicCore/Music/PlayerQueue.cs +++ b/TomatenMusicCore/Music/PlayerQueue.cs @@ -95,7 +95,7 @@ namespace TomatenMusic.Music public MusicActionResponse NextTrack(bool ignoreLoop = false) { if (LastTrack != null) - PlayedTracks = new Queue(PlayedTracks.Prepend(LastTrack)); + PlayedTracks = new Queue(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero)))); switch (LoopType) {