fix skipping within queue while playing in a context
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
abs3nt 2023-04-16 10:58:50 -07:00
parent b5f76fb321
commit efb03c1aad
Signed by: abs3nt
GPG Key ID: FDC6662313FA9386
4 changed files with 12 additions and 6 deletions

View File

@ -25,6 +25,6 @@ var nextCmd = &cobra.Command{
return err
}
}
return commands.Next(ctx, skipAmt)
return commands.Next(ctx, skipAmt, false)
},
}

View File

@ -793,7 +793,13 @@ func (c *Commands) Unlike(ctx *gctx.Context) error {
return nil
}
func (c *Commands) Next(ctx *gctx.Context, amt int) error {
func (c *Commands) Next(ctx *gctx.Context, amt int, inqueue bool) error {
if inqueue {
for i := 0; i < amt; i++ {
c.Client().Next(ctx)
}
return nil
}
if amt == 1 {
err := c.Client().Next(ctx)
if err != nil {

View File

@ -86,14 +86,14 @@ func HandlePlayTrack(ctx *gctx.Context, commands *commands.Commands, track spoti
if err != nil {
return
}
err = commands.Next(ctx, 1)
err = commands.Next(ctx, 1, false)
if err != nil {
return
}
}
func HandleSkipWithinContext(ctx *gctx.Context, commands *commands.Commands, amt int) {
err := commands.Next(ctx, amt)
func HandleNextInQueue(ctx *gctx.Context, commands *commands.Commands, amt int) {
err := commands.Next(ctx, amt, true)
if err != nil {
return
}

View File

@ -276,7 +276,7 @@ func (m *mainModel) SelectItem() error {
case Queue:
page = 1
go func() {
HandleSkipWithinContext(m.ctx, m.commands, m.list.Index())
HandleNextInQueue(m.ctx, m.commands, m.list.Index())
new_items, err := QueueView(m.ctx, m.commands)
if err != nil {
return