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{
Use: "like",
Short: "Likes song",
Long: `Likes song`,
Use: "like",
Aliases: []string{"l"},
Short: "Likes song",
Long: `Likes song`,
Run: func(cmd *cobra.Command, args []string) {
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{
Use: "play",
Short: "Plays spotify",
Long: `Plays queued song on spotify, uses last used device and activates it if needed`,
Use: "play",
Aliases: []string{"p"},
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) {
commands.Play(ctx, client)
},

View File

@ -11,9 +11,10 @@ func init() {
}
var previousCmd = &cobra.Command{
Use: "previous",
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`,
Use: "previous",
Aliases: []string{"b"},
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) {
commands.Previous(ctx, client)
},

View File

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

View File

@ -11,9 +11,10 @@ func init() {
}
var refillRadioCmd = &cobra.Command{
Use: "refillradio",
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`,
Use: "refillradio",
Aliases: []string{"rr"},
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) {
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{
Use: "toggleplay",
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`,
Use: "toggleplay",
Aliases: []string{"t"},
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) {
commands.TogglePlay(ctx, client)
},

View File

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