Cleaned up PR

This commit is contained in:
Kwoth 2016-12-27 01:35:46 +01:00
parent d08abbafd0
commit 67a6b69088
2 changed files with 44 additions and 63 deletions

View File

@ -47,25 +47,7 @@ namespace NadekoBot.Modules.Music.Classes
public string PrettyFullTime => PrettyCurrentTime + " / " + PrettyTotalTime; public string PrettyFullTime => PrettyCurrentTime + " / " + PrettyTotalTime;
//public string PrettyName => $"**[{SongInfo.Title.TrimTo(70)}]({SongInfo.Query})**"; public string PrettyName => $"**[{SongInfo.Title.TrimTo(65)}]({songUrl})**";
public string PrettyName {
get {
switch (SongInfo.ProviderType)
{
case MusicType.Normal:
return $"**[{SongInfo.Title.TrimTo(70)}]({SongInfo.Query})**";
case MusicType.Soundcloud:
return $"**[{SongInfo.Title.TrimTo(70)}]({SongInfo.Query})**";
case MusicType.Local:
return $"**{SongInfo.Title.TrimTo(70)}**";
case MusicType.Radio:
return $"**{SongInfo.Title.TrimTo(70)}**";
default:
return "";
}
}
}
public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}"; public string PrettyInfo => $"{PrettyTotalTime} | {PrettyProvider} | {QueuerName}";
@ -86,25 +68,24 @@ namespace NadekoBot.Modules.Music.Classes
public string Thumbnail { public string Thumbnail {
get { get {
switch (SongInfo.Provider) switch (SongInfo.ProviderType)
{ {
case "YouTube": case MusicType.Radio:
//todo have videoid in songinfo from the start //todo have videoid in songinfo from the start
var videoId = Regex.Match(SongInfo.Query, "<=v=[a-zA-Z0-9-]+(?=&)|(?<=[0-9])[^&\n]+|(?<=v=)[^&\n]+"); 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"; return $"https://img.youtube.com/vi/{ videoId }/0.jpg";
case "SoundCloud": case MusicType.Normal:
return SongInfo.AlbumArt;
case "Local File":
return $"https://cdn.discordapp.com/attachments/155726317222887425/261850914783100928/1482522077_music.png"; //test links
case "Radio Stream":
return $"https://cdn.discordapp.com/attachments/155726317222887425/261850925063340032/1482522097_radio.png"; //test links return $"https://cdn.discordapp.com/attachments/155726317222887425/261850925063340032/1482522097_radio.png"; //test links
default: case MusicType.Local:
return $"https://cdn.discordapp.com/attachments/155726317222887425/261850914783100928/1482522077_music.png"; //test links
case MusicType.Soundcloud:
return SongInfo.AlbumArt;
}
return ""; return "";
} }
}
} }
public string songURL { private string songUrl {
get { get {
switch (SongInfo.ProviderType) switch (SongInfo.ProviderType)
{ {

View File

@ -240,7 +240,7 @@ namespace NadekoBot.Modules.Music
.WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}")) .WithFooter(ef => ef.WithText($"{currentSong.PrettyProvider} | {currentSong.QueuerName}"))
.WithOkColor() .WithOkColor()
.WithThumbnail(tn => tn.Url = currentSong.Thumbnail) .WithThumbnail(tn => tn.Url = currentSong.Thumbnail)
.WithUrl(currentSong.songURL); .WithUrl(currentSong.SongUrl);
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false); await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
} }