fix history always showing same track when using autoplay

fix tracks in history still having timestamps
This commit is contained in:
Tim Müller 2022-03-29 22:34:01 +02:00
parent 147eed234f
commit fa9aa36c94
2 changed files with 3 additions and 2 deletions

@ -109,7 +109,7 @@ namespace TomatenMusic.Music
MusicActionResponse response; MusicActionResponse response;
try try
{ {
response = PlayerQueue.NextTrack(true); response = PlayerQueue.(true);
}catch (Exception ex) }catch (Exception ex)
{ {
if (Autoplay) 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)); 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}"); _logger.LogInformation($"Autoplaying for track {oldTrack.TrackIdentifier} with Track {newTrack.TrackIdentifier}");
await base.OnTrackEndAsync(eventArgs); await base.OnTrackEndAsync(eventArgs);
PlayerQueue.LastTrack = newTrack;
await newTrack.Play(this); await newTrack.Play(this);
QueuePrompt.UpdateFor(GuildId); QueuePrompt.UpdateFor(GuildId);

@ -95,7 +95,7 @@ namespace TomatenMusic.Music
public MusicActionResponse NextTrack(bool ignoreLoop = false) public MusicActionResponse NextTrack(bool ignoreLoop = false)
{ {
if (LastTrack != null) if (LastTrack != null)
PlayedTracks = new Queue<TomatenMusicTrack>(PlayedTracks.Prepend(LastTrack)); PlayedTracks = new Queue<TomatenMusicTrack>(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero))));
switch (LoopType) switch (LoopType)
{ {