From e87a56a79dec3e3605840f7a4850613200625683 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 27 Dec 2016 15:18:12 +0100 Subject: [PATCH] Even more epic improvements to music --- src/NadekoBot/Modules/Music/Classes/MusicControls.cs | 2 ++ src/NadekoBot/Modules/Music/Classes/Song.cs | 4 ++-- src/NadekoBot/Modules/Music/Music.cs | 11 ++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/NadekoBot/Modules/Music/Classes/MusicControls.cs b/src/NadekoBot/Modules/Music/Classes/MusicControls.cs index bf3be763..601a18c4 100644 --- a/src/NadekoBot/Modules/Music/Classes/MusicControls.cs +++ b/src/NadekoBot/Modules/Music/Classes/MusicControls.cs @@ -75,6 +75,8 @@ namespace NadekoBot.Modules.Music.Classes private ConcurrentQueue actionQueue { get; set; } = new ConcurrentQueue(); + public string PrettyVolume => $"🔉 {(int)(Volume * 100)}%"; + public MusicPlayer(IVoiceChannel startingVoiceChannel, float? defaultVolume) { if (startingVoiceChannel == null) diff --git a/src/NadekoBot/Modules/Music/Classes/Song.cs b/src/NadekoBot/Modules/Music/Classes/Song.cs index c4e53336..c7dfeaf0 100644 --- a/src/NadekoBot/Modules/Music/Classes/Song.cs +++ b/src/NadekoBot/Modules/Music/Classes/Song.cs @@ -49,9 +49,9 @@ namespace NadekoBot.Modules.Music.Classes public string PrettyName => $"**[{SongInfo.Title.TrimTo(65)}]({songUrl})**"; - public string PrettyInfo => $"🔉 {(int)(MusicPlayer.Volume * 100)}% | {PrettyTotalTime} | {PrettyProvider} | {QueuerName}"; + public string PrettyInfo => $"{MusicPlayer.PrettyVolume} | {PrettyTotalTime} | {PrettyProvider} | {QueuerName}"; - public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*"; + public string PrettyFullName => $"{PrettyName}\n\t\t`{PrettyTotalTime} | {PrettyProvider} | {QueuerName}`"; public string PrettyCurrentTime => CurrentTime.ToString(@"mm\:ss"); diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index 182666fd..47f6e722 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -193,6 +193,8 @@ namespace NadekoBot.Modules.Music int startAt = itemsPerPage * (page - 1); var number = 0 + startAt; + var total = musicPlayer.TotalPlaytime; + var maxPlaytime = musicPlayer.MaxPlaytimeSeconds; var embed = new EmbedBuilder() .WithAuthor(eab => eab.WithName($"Player Queue - Page {page}") .WithMusicIcon()) @@ -200,7 +202,9 @@ namespace NadekoBot.Modules.Music .Skip(startAt) .Take(10) .Select(v => $"`{++number}.` {v.PrettyFullName}"))) - .WithFooter(ef => ef.WithText($"{musicPlayer.Playlist.Count} tracks currently queued.")) + .WithFooter(ef => ef.WithText($"{musicPlayer.PrettyVolume} | {musicPlayer.Playlist.Count} " + +$"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {total.Minutes}m {total.Seconds}s | " + +(musicPlayer.FairPlay? "✔️fairplay" : "✖️fairplay") + $" | " + (maxPlaytime == 0 ? "unlimited" : $"{maxPlaytime}s limit"))) .WithOkColor(); if (musicPlayer.RepeatSong) @@ -235,7 +239,8 @@ namespace NadekoBot.Modules.Music var embed = new EmbedBuilder().WithOkColor() .WithAuthor(eab => eab.WithName("Now Playing").WithMusicIcon()) .WithDescription(currentSong.PrettyName) - .WithFooter(ef => ef.WithText(currentSong.PrettyFullTime + $" | {currentSong.PrettyProvider} | {currentSong.QueuerName}")); + .WithThumbnail(tn => tn.Url = currentSong.Thumbnail) + .WithFooter(ef => ef.WithText(musicPlayer.PrettyVolume + " | " + currentSong.PrettyFullTime + $" | {currentSong.PrettyProvider} | {currentSong.QueuerName}")); await channel.EmbedAsync(embed.Build()).ConfigureAwait(false); } @@ -563,7 +568,7 @@ namespace NadekoBot.Modules.Music [RequireContext(ContextType.Guild)] public async Task SetMaxPlaytime(IUserMessage imsg, uint seconds) { - if (seconds < 15) + if (seconds < 15 && seconds != 0) return; var channel = (ITextChannel)imsg.Channel;