diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index 493e3c08..c1280613 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -227,10 +227,18 @@ namespace NadekoBot.Modules.Music desc = $"`🔊` {songs[current].PrettyFullName}\n\n" + desc; + if (mp.RepeatCurrentSong) desc = "🔂 " + GetText("repeating_cur_song") + "\n\n" + desc; else if (mp.Shuffle) desc = "🔀 " + GetText("shuffling_playlist") + "\n\n" + desc; + else + { + if(mp.Autoplay) + desc = "↪ " + GetText("autoplaying") + "\n\n" + desc; + if (mp.RepeatPlaylist) + desc = "🔁 " + GetText("repeating_playlist") + "\n\n" + desc; + } var embed = new EmbedBuilder() .WithAuthor(eab => eab.WithName(GetText("player_queue", curPage + 1, lastPage + 1)) @@ -797,8 +805,7 @@ namespace NadekoBot.Modules.Music // else // await ReplyConfirmLocalized("max_playtime_set", seconds).ConfigureAwait(false); //} - - //todo test rcs + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task ReptCurSong() @@ -819,8 +826,7 @@ namespace NadekoBot.Modules.Music await Context.Channel.SendConfirmAsync("🔂 " + GetText("repeating_track_stopped")) .ConfigureAwait(false); } - - //todo test rpl + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task RepeatPl() diff --git a/src/NadekoBot/Services/Music/MusicPlayer.cs b/src/NadekoBot/Services/Music/MusicPlayer.cs index e49e8967..5dd87f67 100644 --- a/src/NadekoBot/Services/Music/MusicPlayer.cs +++ b/src/NadekoBot/Services/Music/MusicPlayer.cs @@ -61,6 +61,9 @@ namespace NadekoBot.Services.Music public event Action OnPauseChanged; #endregion + + private bool manualSkip = false; + public MusicPlayer(MusicService musicService, IVoiceChannel vch, ITextChannel output, float volume) { _log = LogManager.GetCurrentClassLogger(); @@ -80,6 +83,7 @@ namespace NadekoBot.Services.Music { data = Queue.Current; cancelToken = SongCancelSource.Token; + manualSkip = false; } try { @@ -142,12 +146,10 @@ namespace NadekoBot.Services.Music } finally { - do - { - await Task.Delay(500); - } - while (Stopped && !Exited); - if (!RepeatCurrentSong) //if repeating current song, just ignore other settings, and play this song again (don't change the index) + //if repeating current song, just ignore other settings, + // and play this song again (don't change the index) + // ignore rcs if song is manually skipped + if (!RepeatCurrentSong || manualSkip) { if (Shuffle) { @@ -172,9 +174,8 @@ namespace NadekoBot.Services.Music _log.Info("Loading related song failed."); } } - else if (Queue.Count == data.Index && !RepeatPlaylist) + else if (Queue.Count - 1 == data.Index && !RepeatPlaylist && !manualSkip) { - //todo test repeatplaylist _log.Info("Stopping because repeatplaylist is disabled"); Stop(); } @@ -185,6 +186,11 @@ namespace NadekoBot.Services.Music } } } + do + { + await Task.Delay(500); + } + while (Stopped && !Exited); } } }, SongCancelSource.Token); @@ -221,10 +227,11 @@ namespace NadekoBot.Services.Music return (true, Queue.Count); } - public void Next(int skipCount) + public void Next(int skipCount = 1) { lock (locker) { + manualSkip = true; Queue.Next(skipCount - 1); Stopped = false; Unpause(); diff --git a/src/NadekoBot/_strings/ResponseStrings.en-US.json b/src/NadekoBot/_strings/ResponseStrings.en-US.json index ab8aea41..a83d8442 100644 --- a/src/NadekoBot/_strings/ResponseStrings.en-US.json +++ b/src/NadekoBot/_strings/ResponseStrings.en-US.json @@ -404,6 +404,7 @@ "music_attempting_to_queue": "Attempting to queue {0} songs...", "music_autoplay_disabled": "Autoplay disabled.", "music_autoplay_enabled": "Autoplay enabled.", + "music_autoplaying": "Auto-playing.", "music_defvol_set": "Default volume set to {0}%", "music_dir_queue_complete": "Directory queue complete.", "music_fairplay": "fairplay",