4 Commits

Author SHA1 Message Date
Tim Müller
3fd19eb149 fix playlist playback nicely 2022-04-01 18:53:07 +02:00
Tim Müller
bc7e493e71 fix playlist playback not working 2022-04-01 18:46:03 +02:00
Tim Müller
85dbbd8bfc fix file playback 2022-03-31 18:37:35 +02:00
Tim Müller
e5d3f6935d fix errors 2022-03-29 22:36:46 +02:00
5 changed files with 9 additions and 27 deletions

View File

@@ -46,9 +46,9 @@ namespace TomatenMusic_Api
if (e.Response.IsPlaylist) if (e.Response.IsPlaylist)
{ {
if (e.Now) if (e.Now)
await player.PlayPlaylistNowAsync(e.Response.Playlist); await player.PlayNowAsync(e.Response.Playlist);
else else
await player.PlayPlaylistAsync(e.Response.Playlist); await player.PlayItemAsync(e.Response.Playlist);
}else }else
{ {
if (e.Now) if (e.Now)

View File

@@ -84,7 +84,7 @@ namespace TomatenMusic.Commands
if (response.IsPlaylist) if (response.IsPlaylist)
{ {
ILavalinkPlaylist playlist = response.Playlist; ILavalinkPlaylist playlist = response.Playlist;
await player.PlayPlaylistNowAsync(playlist); await player.PlayNowAsync(playlist);
_ = ctx.EditResponseAsync(new DiscordWebhookBuilder().WithContent("Now Playing:").AddEmbed( _ = ctx.EditResponseAsync(new DiscordWebhookBuilder().WithContent("Now Playing:").AddEmbed(
Common.AsEmbed(playlist) Common.AsEmbed(playlist)
@@ -237,7 +237,7 @@ namespace TomatenMusic.Commands
if (response.IsPlaylist) if (response.IsPlaylist)
{ {
ILavalinkPlaylist playlist = response.Playlist; ILavalinkPlaylist playlist = response.Playlist;
await player.PlayPlaylistAsync(playlist); await player.PlayItemAsync(playlist);
await ctx.EditResponseAsync(new DiscordWebhookBuilder().WithContent("Now Playing:").AddEmbed( await ctx.EditResponseAsync(new DiscordWebhookBuilder().WithContent("Now Playing:").AddEmbed(
Common.AsEmbed(playlist) Common.AsEmbed(playlist)

View File

@@ -20,7 +20,7 @@ namespace TomatenMusic.Music.Entitites
public IEnumerable<string> YoutubeTags { get; set; } public IEnumerable<string> YoutubeTags { get; set; }
public ulong YoutubeViews { get; set; } public ulong YoutubeViews { get; set; }
public ulong YoutubeLikes { get; set; } public ulong YoutubeLikes { get; set; }
public Uri YoutubeThumbnail { get; set; } public Uri? YoutubeThumbnail { get; set; } = null;
public DateTime YoutubeUploadDate { get; set; } public DateTime YoutubeUploadDate { get; set; }
// //
// Summary: // Summary:

View File

@@ -64,26 +64,6 @@ namespace TomatenMusic.Music
QueuePrompt.UpdateFor(GuildId); QueuePrompt.UpdateFor(GuildId);
} }
public async Task PlayPlaylistAsync(ILavalinkPlaylist playlist)
{
EnsureNotDestroyed();
EnsureConnected();
_logger.LogInformation("Started playing Playlist {0} on Guild {1}", playlist.Title, (await GetGuildAsync()).Name);
QueuePrompt.UpdateFor(GuildId);
}
public async Task PlayPlaylistNowAsync(ILavalinkPlaylist playlist)
{
EnsureConnected();
EnsureNotDestroyed();
QueuePrompt.UpdateFor(GuildId);
}
public async Task RewindAsync() public async Task RewindAsync()
{ {
EnsureNotDestroyed(); EnsureNotDestroyed();
@@ -109,7 +89,7 @@ namespace TomatenMusic.Music
MusicActionResponse response; MusicActionResponse response;
try try
{ {
response = PlayerQueue.(true); response = PlayerQueue.NextTrack(true);
}catch (Exception ex) }catch (Exception ex)
{ {
if (Autoplay) if (Autoplay)

View File

@@ -32,10 +32,12 @@ namespace TomatenMusic.Util
DiscordEmbedBuilder builder = new DiscordEmbedBuilder() DiscordEmbedBuilder builder = new DiscordEmbedBuilder()
.WithTitle(track.Title) .WithTitle(track.Title)
.WithUrl(track.Source) .WithUrl(track.Source)
.WithImageUrl(context.YoutubeThumbnail)
.WithDescription(context.YoutubeDescription) .WithDescription(context.YoutubeDescription)
.AddField("Length", Common.GetTimestamp(track.Duration), true); .AddField("Length", Common.GetTimestamp(track.Duration), true);
if (context.YoutubeThumbnail != null)
builder.WithImageUrl(context.YoutubeThumbnail);
if (context.IsFile) if (context.IsFile)
{ {
builder.WithAuthor(track.Author); builder.WithAuthor(track.Author);