player

package
v1.0.56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeviceCommand = &cobra.Command{
	Use:   "device",
	Short: "Get all connected devices",
	Run: func(cmd *cobra.Command, args []string) {
		Device()
	},
}
View Source
var NextCommand = &cobra.Command{
	Use:   "next",
	Short: "Next spotify song",
	Run: func(cmd *cobra.Command, args []string) {
		token := server.ReadUserModifyTokenOrFetchFromServer()
		Next(token, true)
	},
}
View Source
var PauseCommand = &cobra.Command{
	Use:   "pause",
	Short: "Pause spotify song",
	Run: func(cmd *cobra.Command, args []string) {
		token := server.ReadUserModifyTokenOrFetchFromServer()
		pause(token)
	},
}
View Source
var PlayCommand = &cobra.Command{
	Use:   "play",
	Short: "Play spotify song",
	Run: func(cmd *cobra.Command, args []string) {
		token := server.ReadUserModifyTokenOrFetchFromServer()
		Play(token, "")
	},
}
View Source
var PreviousCommand = &cobra.Command{
	Use:   "previous",
	Short: "Previous spotify song",
	Run: func(cmd *cobra.Command, args []string) {
		token := server.ReadUserModifyTokenOrFetchFromServer()
		previous(token)
	},
}
View Source
var SavedCommand = &cobra.Command{
	Use:   "saved",
	Short: "Saved spotify tracks",
	PreRun: func(cmd *cobra.Command, args []string) {
		loader.Stop()
	},
	Run: func(cmd *cobra.Command, args []string) {
		token := server.ReadUserLibraryReadTokenOrFetchFromServer()
		result := saved(token, "")
		if len(result.PlayUrl) > 0 {
			token := server.ReadUserModifyTokenOrFetchFromServer()

			AddToQueue(token, result.PlayUrl)
			Next(token, false)
		}
	},
}
View Source
var VolumeCommand = &cobra.Command{
	Use:   "volume [value]",
	Short: "Set volume",
	PreRunE: func(cmd *cobra.Command, args []string) error {
		if VolumeValue == "" {
			return fmt.Errorf("volume value is required")
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		token := server.ReadUserModifyTokenOrFetchFromServer()
		volume(token)
	},
}
View Source
var VolumeValue string

Functions

func ActivateDevice

func ActivateDevice(deviceIds string)

func AddToQueue

func AddToQueue(accessToken string, url string)

func Device

func Device()

func Next

func Next(accessToken string, callPlayer bool)

func Play

func Play(accessToken string, URI string)

func Player

func Player()

Types

type DeviceResponse

type DeviceResponse struct {
	Devices []types.DeviceType `json:"devices"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL