This commit is contained in:
abs3nt 2023-01-13 23:06:43 -08:00
parent 8249488f25
commit 874712bbb2
9 changed files with 46 additions and 39 deletions

View File

@ -11,9 +11,10 @@ func init() {
} }
var likeCmd = &cobra.Command{ var likeCmd = &cobra.Command{
Use: "like", Use: "like",
Short: "Likes song", Aliases: []string{"l"},
Long: `Likes song`, Short: "Likes song",
Long: `Likes song`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
commands.Like(ctx, client) commands.Like(ctx, client)
}, },

21
src/cmd/next.go Normal file
View File

@ -0,0 +1,21 @@
package cmd
import (
"gospt/src/commands"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(nextCmd)
}
var nextCmd = &cobra.Command{
Use: "next",
Aliases: []string{"n"},
Short: "Skip to next song",
Long: `Skip to next song`,
Run: func(cmd *cobra.Command, args []string) {
commands.Next(ctx, client)
},
}

View File

@ -11,9 +11,10 @@ func init() {
} }
var playCmd = &cobra.Command{ var playCmd = &cobra.Command{
Use: "play", Use: "play",
Short: "Plays spotify", Aliases: []string{"p"},
Long: `Plays queued song on spotify, uses last used device and activates it if needed`, Short: "Plays spotify",
Long: `Plays queued song on spotify, uses last used device and activates it if needed`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
commands.Play(ctx, client) commands.Play(ctx, client)
}, },

View File

@ -11,9 +11,10 @@ func init() {
} }
var previousCmd = &cobra.Command{ var previousCmd = &cobra.Command{
Use: "previous", Use: "previous",
Short: "goes to previous song", Aliases: []string{"b"},
Long: `if song is playing it will start over, if close to begining of song it will go to previous song`, Short: "goes to previous song",
Long: `if song is playing it will start over, if close to begining of song it will go to previous song`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
commands.Previous(ctx, client) commands.Previous(ctx, client)
}, },

View File

@ -11,9 +11,10 @@ func init() {
} }
var radioCmd = &cobra.Command{ var radioCmd = &cobra.Command{
Use: "radio", Use: "radio",
Short: "Starts radio", Aliases: []string{"r"},
Long: `Starts radio`, Short: "Starts radio",
Long: `Starts radio`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return commands.Radio(ctx, client) return commands.Radio(ctx, client)
}, },

View File

@ -11,9 +11,10 @@ func init() {
} }
var refillRadioCmd = &cobra.Command{ var refillRadioCmd = &cobra.Command{
Use: "refillradio", Use: "refillradio",
Short: "Refills the radio", Aliases: []string{"rr"},
Long: `Deletes all songs up to your position in the radio and adds that many songs to the end of the radio`, Short: "Refills the radio",
Long: `Deletes all songs up to your position in the radio and adds that many songs to the end of the radio`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
commands.RefillRadio(ctx, client) commands.RefillRadio(ctx, client)
}, },

View File

@ -1,20 +0,0 @@
package cmd
import (
"gospt/src/commands"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(skipCmd)
}
var skipCmd = &cobra.Command{
Use: "skip",
Short: "Skip to next song",
Long: `Skip to next song`,
Run: func(cmd *cobra.Command, args []string) {
commands.Skip(ctx, client)
},
}

View File

@ -11,9 +11,10 @@ func init() {
} }
var togglePlayCmd = &cobra.Command{ var togglePlayCmd = &cobra.Command{
Use: "toggleplay", Use: "toggleplay",
Short: "Toggles the play state of spotify", Aliases: []string{"t"},
Long: `If you are playing a song it will pause and if a song is paused it will play`, Short: "Toggles the play state of spotify",
Long: `If you are playing a song it will pause and if a song is paused it will play`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
commands.TogglePlay(ctx, client) commands.TogglePlay(ctx, client)
}, },

View File

@ -499,7 +499,7 @@ func Unlike(ctx *gctx.Context, client *spotify.Client) error {
return nil return nil
} }
func Skip(ctx *gctx.Context, client *spotify.Client) error { func Next(ctx *gctx.Context, client *spotify.Client) error {
err := client.Next(ctx) err := client.Next(ctx)
if err != nil { if err != nil {
return err return err