owenthereal / spotctl

A command-line interface to Spotify, written in Go
MIT License
243 stars 16 forks source link

List Albums, Tracks, Artists; and set Playback Device #13

Open aakropotkin opened 6 years ago

aakropotkin commented 6 years ago

The only relevant changes are to main.go and ctl.go

I added functions to dump data from a user's saved library. I wanted this for myself so that I could use it with FZF to search my saved music; but it will surely be useful for others. It basically dumps a cache for each one.

you may now : 'spotctl albums' 'spotctl artists' 'spotctl tracks'

Extensions: It would be nice to utilize this functionality to have "search and play" prefer a user's saved lists by default, and then fall back to searching the entire Spotify database. This would prevent searching for a song that you like and winding up with some other random version of it or one with a similar name.

2.

I added the ability to change playback device using 'setdevice' which takes the device name as input. (use 'spotctl devices' to find device name and use that as input)

'spotctl setdevice "Brian's iPhone"'

ps. This is my first time writing "go lang", I kind of just figured out enough to make this stuff work. There are surely small fixes to be made.

aakropotkin commented 6 years ago

NOTE: I just realized there is some buggy behavior with "setdevice" It does correctly transfer playback, but if you then try to choose a new track it returns back to the original playback device. I think there is something that I do not understand about "deviceNameFlag" which I believe is likely causing this behavior.

aakropotkin commented 6 years ago

Removing the "deviceNameFlag" portions from the existing code base seemed to fix the issue. I'm not sure exactly how that was meant to function. The issue is that when it is left as an empty param it will automatically select the first device in the "devices" list which is problematic. Most likely I am misunderstanding what it's intended purpose was. Removing them has made the "spotctl -t album foo", or any "-t" argument act funny. I'm assuming I fucked up how the arguments are read. I keep getting a "Error: Command failed: Not paused" Which I'm assuming is not an accurate error message.

aakropotkin commented 6 years ago

If a search result fails the program seg faults. Would be nicer to have an error message. I thought something was really broken for a while.