Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dinofizz/diskplayer
/ functions
Functions
78 in github.com/dinofizz/diskplayer
⨍
Functions
78
◇
Types & classes
9
↓ 12 callers
Function
ConfigValue
ConfigValue returns the configuration value identified by the provided key. If none is found the application quits with an error message and exit code
config.go:26
↓ 9 callers
Function
PlayUri
PlayURI will play the album or playlist Spotify URI that is passed in to the function. An error is returned if one is encountered.
diskplayer.go:36
↓ 6 callers
Function
Pause
Pause will pause the Spotify playback if the Diskplayer is the currently active Spotify device. An error is returned if one is encountered.
diskplayer.go:77
↓ 6 callers
Function
errorPage
errorPage returns an HTML error page, inserting error details into the error.html template.
server.go:137
↓ 5 callers
Function
NewAuthenticator
NewAuthenticator returns a Spotify authenticator object configured with the required callback URL, client IT and client secret. An error is returned i
auth.go:16
↓ 4 callers
Function
NewDiskplayerServer
NewDiskplayerServer returns a new DiskplayerServer instance. The arguments are required if the server instance is to be used to obtain a new Spotify a
server.go:31
↓ 4 callers
Function
PlayPath
PlayPath will play an album or playlist by reading a Spotify URI from a file whose filepath is passed into the function. An error is returned if one i
diskplayer.go:14
↓ 4 callers
Function
ReadConfig
ReadConfig reads in the configuration values from the diskplayer.yaml configuration file.
config.go:10
↓ 3 callers
Function
NewToken
NewToken will create a new OAuth2 token request. The user will be prompted to visit a URL, and after access is granted a new OAuth2 token is returned.
auth.go:37
↓ 3 callers
Method
Pause
()
client.go:16
↓ 3 callers
Method
PlayerDevices
()
client.go:15
↓ 3 callers
Function
ReadToken
ReadToken will attempt to deserialize a token whose path is defined in the diskplayer.yaml configuration file under the token.file_path field. Returns
auth.go:61
↓ 3 callers
Function
Record
Record takes in a web URL which links to a Spotify album or playlist and records the corresponding Spotify ID to the filepath specified in the diskpla
recorder.go:14
↓ 3 callers
Function
SaveToken
SaveToken will serialize the provided token and save it to the file whose path is defined in the diskplayer. yaml configuration file under the token.f
auth.go:77
↓ 2 callers
Method
Authenticator
()
server.go:26
↓ 2 callers
Function
NewClient
Returns an authenticated Spotify client object, or an error if encountered.
client.go:9
↓ 2 callers
Method
PlayOpt
(opt *spotify.PlayOptions)
client.go:18
↓ 2 callers
Method
RunCallbackServer
()
server.go:24
↓ 2 callers
Method
TokenChannel
()
server.go:25
↓ 2 callers
Method
TransferPlayback
(deviceID spotify.ID, play bool)
client.go:17
↓ 2 callers
Function
activePlayerId
activePlayerIds iterates through the provided player devices and returns the active ID. If there is no active Spotify client device the ID will be ret
diskplayer.go:106
↓ 2 callers
Function
diskplayerId
diskplayerId returns the Spotify ID for the Spotify client whose name is provided in the parameter list, or a nil pointer if no matching device is fou
diskplayer.go:118
↓ 1 callers
Method
RunRecordServer
()
server.go:23
↓ 1 callers
Method
ServeHTTP
An implementation of the Handler ServeHTTP function for the CallbackHandler struct.
server.go:149
↓ 1 callers
Function
createSpotifyUri
createSpotifyUri creates a Spotify URI from the web URL. The web URL should be something like https://open.spotify.com/album/1S7mumn7D4riEX2gVWYgPO A
recorder.go:31
↓ 1 callers
Function
writeToDisk
writeToDisk takes a string containing a Spotify URI and writes to the the filepath specified in the diskplayer.yaml configuration file under the recor
recorder.go:48
Method
Authenticator
()
server.go:78
Method
Authenticator
Authenticator provides a mock function with given fields:
mocks/DiskplayerServer.go:16
Method
Pause
Pause will pause playback for the currently active device.
client.go:32
Method
Pause
Pause provides a mock function with given fields:
mocks/Client.go:14
Method
PlayOpt
PlayOpt will initiate playback on the device as specified in the PlayOptions.
client.go:42
Method
PlayOpt
PlayOpt provides a mock function with given fields: opt
mocks/Client.go:28
Method
PlayerDevices
PlayerDevices will return a list of available Spotify devices. An error is returned if encountered.
client.go:26
Method
PlayerDevices
PlayerDevices provides a mock function with given fields:
mocks/Client.go:42
Method
RunCallbackServer
RunCallbackServer creates a web server running on the port defined in the configuration file under the spotify. callback_url field. A pointer to the s
server.go:58
Method
RunCallbackServer
RunCallbackServer provides a mock function with given fields:
mocks/DiskplayerServer.go:32
Method
RunRecordServer
RunRecordServer creates a web server running on the port defined in the configuration file under the recorder. server_port field. Files are served dir
server.go:46
Method
RunRecordServer
RunRecordServer provides a mock function with given fields:
mocks/DiskplayerServer.go:55
Function
TestConfigValue
(t *testing.T)
config_test.go:18
Function
TestErrorHandler
(t *testing.T)
server_test.go:38
Function
TestIndexHandler
(t *testing.T)
server_test.go:44
Function
TestNewAuthenticator
(t *testing.T)
auth_test.go:17
Function
TestNewAuthenticatorParseURLError
(t *testing.T)
auth_test.go:25
Function
TestNewClient
(t *testing.T)
client_test.go:11
Function
TestNewDiskplayerServer
(t *testing.T)
server_test.go:16
Function
TestNewToken
(t *testing.T)
auth_test.go:31
Function
TestNewTokenCallbackServerError
(t *testing.T)
auth_test.go:72
Function
TestPauseDeviceNotFound
(t *testing.T)
diskplayer_test.go:283
Function
TestPauseError
(t *testing.T)
diskplayer_test.go:319
Function
TestPauseNoneActiveSuccess
(t *testing.T)
diskplayer_test.go:251
Function
TestPausePlayerDevicesError
(t *testing.T)
diskplayer_test.go:306
Function
TestPauseSuccess
(t *testing.T)
diskplayer_test.go:219
Function
TestPlayPathEmptyFileError
(t *testing.T)
diskplayer_test.go:69
Function
TestPlayPathInvalidPath
(t *testing.T)
diskplayer_test.go:61
Function
TestPlayPathSuccess
(t *testing.T)
diskplayer_test.go:38
Function
TestPlayUrPlayerDevicesError
(t *testing.T)
diskplayer_test.go:81
Function
TestPlayUriDeviceNotFoundError
(t *testing.T)
diskplayer_test.go:94
Function
TestPlayUriNoUriError
(t *testing.T)
diskplayer_test.go:75
Function
TestPlayUriSuccess
(t *testing.T)
diskplayer_test.go:15
Function
TestPlayUriTransferPlaybackPauseError
(t *testing.T)
diskplayer_test.go:151
Function
TestPlayUriTransferPlaybackSuccess
(t *testing.T)
diskplayer_test.go:117
Function
TestPlayUriTransferPlaybackTransferError
(t *testing.T)
diskplayer_test.go:184
Function
TestReadConfigError
(t *testing.T)
config_test.go:8
Function
TestReadToken
(t *testing.T)
auth_test.go:89
Function
TestReadTokenFileError
(t *testing.T)
auth_test.go:100
Function
TestRealDiskplayerServer_RunCallbackServer
(t *testing.T)
server_test.go:24
Function
TestRecord
(t *testing.T)
recorder_test.go:23
Function
TestRecordWriteError
(t *testing.T)
recorder_test.go:64
Function
TestSaveToken
(t *testing.T)
auth_test.go:109
Function
TestSaveTokenWriteError
(t *testing.T)
auth_test.go:133
Method
TokenChannel
()
server.go:74
Method
TokenChannel
TokenChannel provides a mock function with given fields:
mocks/DiskplayerServer.go:69
Method
TransferPlayback
TransferPlayback will transfer the Spotify playback to the specified device.
client.go:37
Method
TransferPlayback
TransferPlayback provides a mock function with given fields: deviceID, play
mocks/Client.go:65
Function
indexHandler
indexHandler handles requests to the server for the root location "/". A listing of the attached devices is obtained and applied to the index.html tem
server.go:124
Function
main
()
cmd/player/main.go:11
Function
main
()
cmd/recorder/main.go:8
Function
recordHandler
recordHandler handles requests to the server which contain a Spotify web URL to be recorded. Two values are extracted from the request: web_url and de
server.go:88