music updates
This commit is contained in:
parent
8b48d1e9be
commit
1808d4961f
@ -50,8 +50,6 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
|
|
||||||
public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
|
public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
|
||||||
|
|
||||||
public string PTT => $"{PrettyTotalTime}";
|
|
||||||
|
|
||||||
public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*";
|
public string PrettyFullName => $"{PrettyName}\n\t\t*{PrettyInfo}*";
|
||||||
|
|
||||||
public string PrettyCurrentTime => CurrentTime.ToString(@"mm\:ss");
|
public string PrettyCurrentTime => CurrentTime.ToString(@"mm\:ss");
|
||||||
@ -67,6 +65,24 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Thumbnail {
|
||||||
|
get {
|
||||||
|
switch (SongInfo.ProviderType)
|
||||||
|
{
|
||||||
|
case MusicType.Normal:
|
||||||
|
//todo have videoid in songinfo from the start
|
||||||
|
var videoId = Regex.Match(SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+");
|
||||||
|
return $"https://img.youtube.com/vi/{ videoId }/0.jpg";
|
||||||
|
case MusicType.Soundcloud:
|
||||||
|
return SongInfo.AlbumArt;
|
||||||
|
case MusicType.Local:
|
||||||
|
case MusicType.Radio:
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int skipTo = 0;
|
private int skipTo = 0;
|
||||||
public int SkipTo {
|
public int SkipTo {
|
||||||
get { return skipTo; }
|
get { return skipTo; }
|
||||||
|
@ -217,26 +217,16 @@ namespace NadekoBot.Modules.Music
|
|||||||
if (currentSong == null)
|
if (currentSong == null)
|
||||||
return;
|
return;
|
||||||
try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
||||||
var videoid = Regex.Match(currentSong.SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+");
|
|
||||||
|
|
||||||
var embed = new EmbedBuilder()
|
var embed = new EmbedBuilder()
|
||||||
.WithAuthor(eab => eab.WithName("Now Playing")
|
.WithAuthor(eab => eab.WithName("Now Playing")
|
||||||
.WithMusicIcon())
|
.WithMusicIcon())
|
||||||
.WithTitle($"{currentSong.SongInfo.Title}")
|
.WithTitle($"{currentSong.SongInfo.Title}")
|
||||||
.WithDescription(currentSong.PrettyCurrentTime + "/" + currentSong.PTT)
|
.WithDescription(currentSong.PrettyFullTime)
|
||||||
.WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}"))
|
.WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}"))
|
||||||
.WithOkColor();
|
.WithOkColor()
|
||||||
if (currentSong.SongInfo.Provider.Equals("YouTube", StringComparison.OrdinalIgnoreCase))
|
.WithThumbnail(tn => tn.Url = currentSong.Thumbnail)
|
||||||
{
|
.WithUrl(currentSong.SongInfo.Query);
|
||||||
embed.WithThumbnail(tn => tn.Url = $"https://img.youtube.com/vi/{videoid}/0.jpg");
|
|
||||||
embed.WithUrl($"{currentSong.SongInfo.Query}");
|
|
||||||
}
|
|
||||||
else if (currentSong.SongInfo.Provider.Equals("SoundCloud", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
embed.WithThumbnail(tn => tn.Url = $"{currentSong.SongInfo.AlbumArt}");
|
|
||||||
embed.WithUrl($"{currentSong.SongInfo.Query}");
|
|
||||||
}
|
|
||||||
|
|
||||||
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,16 +332,6 @@ namespace NadekoBot.Modules.Music
|
|||||||
|
|
||||||
await Task.WhenAny(tasks, Task.Delay(Timeout.Infinite, cancelSource.Token));
|
await Task.WhenAny(tasks, Task.Delay(Timeout.Infinite, cancelSource.Token));
|
||||||
|
|
||||||
/*foreach (var id in idArray)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (SongNotFoundException) { }
|
|
||||||
catch { break; }
|
|
||||||
}*/
|
|
||||||
|
|
||||||
await msg.ModifyAsync(m => m.Content = "✅ Playlist queue complete.").ConfigureAwait(false);
|
await msg.ModifyAsync(m => m.Content = "✅ Playlist queue complete.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user