helper

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright © 2024 David Muckle <dvdmuckle@dvdmuckle.xyz>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2024 David Muckle <dvdmuckle@dvdmuckle.xyz>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2024 David Muckle <dvdmuckle@dvdmuckle.xyz>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2024 David Muckle <dvdmuckle@dvdmuckle.xyz>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2024 David Muckle <dvdmuckle@dvdmuckle.xyz>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(cmd *cobra.Command, cfgFile string, conf *Config)

Auth authenticates with Spotify and refreshes the token

func CreateConfig added in v0.5.1

func CreateConfig(cfgFile string)

CreateConfig initializes a skeleton config

func GetVerboseErrLogAddr added in v1.1.0

func GetVerboseErrLogAddr() *bool

func LogErrorAndExit added in v1.1.0

func LogErrorAndExit(args ...interface{})

func Pause

func Pause(conf *Config)

Pause wraps the spotify.Client.Pause() method for easy error checking

func Play

func Play(conf *Config)

Play wraps the spotify.Client.Play() method for easy error checking

func RefreshToken

func RefreshToken(client string, secret string, refreshToken string) *oauth2.Token

RefreshToken refreshes the auth token from Spotify

func SetClient

func SetClient(conf *Config)

SetClient sets the Client field of Config struct to a valid Spotify client The Token field in the Config struct must be set

func SetupConfig added in v0.5.1

func SetupConfig() string

SetupConfig sets up the path and type of the config for Viper and also returns the full path to the config

Types

type Config

type Config struct {
	ClientID string
	Secret   string
	Token    oauth2.Token
	Client   *spotify.Client
	DeviceID spotify.ID
}

Config stores constantly accessed variables in memory

Jump to

Keyboard shortcuts

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