using .n when rpl is disabled will stop the queue

This commit is contained in:
Master Kwoth 2017-07-11 20:11:36 +02:00
parent 0e4728d9c9
commit 5e230fad22
2 changed files with 19 additions and 2 deletions

View File

@ -252,8 +252,12 @@ namespace NadekoBot.Services.Music
// ignore rcs if song is manually skipped // ignore rcs if song is manually skipped
int queueCount; int queueCount;
bool stopped;
lock (locker) lock (locker)
{
queueCount = Queue.Count; queueCount = Queue.Count;
stopped = Stopped;
}
if (!manualIndex && (!RepeatCurrentSong || manualSkip)) if (!manualIndex && (!RepeatCurrentSong || manualSkip))
{ {
@ -320,7 +324,8 @@ namespace NadekoBot.Services.Music
_log.Info("Next song"); _log.Info("Next song");
lock (locker) lock (locker)
{ {
Queue.Next(); if(!Stopped)
Queue.Next();
} }
} }
} }
@ -422,7 +427,13 @@ namespace NadekoBot.Services.Music
// if player is stopped, and user uses .n, it should play current song. // if player is stopped, and user uses .n, it should play current song.
// It's a bit weird, but that's the least annoying solution // It's a bit weird, but that's the least annoying solution
if (!Stopped) if (!Stopped)
Queue.Next(skipCount - 1); if (!RepeatPlaylist && Queue.IsLast()) // if it's the last song in the queue, and repeat playlist is disabled
{ //stop the queue
Stop();
return;
}
else
Queue.Next(skipCount - 1);
else else
Queue.CurrentIndex = 0; Queue.CurrentIndex = 0;
Stopped = false; Stopped = false;

View File

@ -172,5 +172,11 @@ namespace NadekoBot.Services.Music
Songs.Remove(song); Songs.Remove(song);
} }
} }
public bool IsLast()
{
lock (locker)
return CurrentIndex == Songs.Count - 1;
}
} }
} }