Closed davidem closed 4 years ago
(forgot to mention this is still a beta feature of the spotify web-api)
Closing this PR because I've already merged a larger one that includes these changes.
was this ever merged into the main branch I cant seem to get it to work?
No, not yet. Harish has created a separate branch: 3.0-pre
If you use that branch, it works like this:
List possible devices for playback: ./spotify list devices 40charidofdevice0123456789abcdefghijklmn Mac Computer true 53 40charidofotherdevice0123456789abcdefghi Soundbar Speaker false 16`
To connect and play from another device: ./spotify connect 40charidofotherdevice0123456789abcdefghi`
true/false indicates if a device is active or not. The numbers show the spotify volume settings.
ahhh got it. it seems this requires user authentication and the redirect uri to http://localhost:8082/ isnt working. just freezes on the authentication page
Ah, yes... good of you to mention that. Completely forgot I had to whitelist that URL. Here's how:
I'll add that info to the 'help' part
hmm I had added it but I just removed the app from my dashboard and readded it and now it works! thanks for your help!
did you include the removal of jq in this branch? seems it still requires it
Indeed, jq is still required. The relative ease of use of jq vs trying to parse json output with commands like grep/awk/tr/cut makes it 1:0 for jq in my opinion.
ahh got it, im trying to put a device list into my menubar so I can choose my devices easily without opening Spotify but both apps that can achieve this (bettertouchtool and bitbar) dont seem to be compatible with jq unfortunately.
I don't get it, sorry ;) I assume with bitbar/bettertouchtool you call shpotify to list your available devices / select your playback devices, right? The output you get from shpotify does not require jq, it's only used to parse the json feedback from spotify.
im not sure tbh. when I use Shpotify from the command line it works with no problems but when I attempt to create the script to select device playback form the menubar I get an error saying I need jq.
ah, thanks, now I think I get it :) My guess is that jq is not in $PATH of the 'user' running the script.
Best way is to add the full path to shpotify. It's fixed in my latest 3.0 version (#144) or found here: https://github.com/davidem/shpotify/tree/3.0
I've updated the JQ check. It first checks $PATH, then it checks if jq is in /usr/local/bin. @moshed: does it now work for you?
hmm still not. my script is this with the full Spotify path
#!/bin/bash
echo spotify
usr/local/bin/spotify list devices
but I still get the same jq error as before? im sure im doing something wrong as opposed to it not functioning properly because im not too savvy at this but I cant figure out what it is
Can you show me where jq is located?
Mine:
➜ ~ which jq
/usr/local/bin/jq
I'll add an option to hardlink to jq later today
same as you
moshe@Moshes-MacBook-Pro ~ % which jq
/usr/local/bin/jq
hey @davidem sorry to be a pain. do you have an idea why jq is not functioning properly when called from bitbar or better touch tool? should I be changing one of these settings?
Hi Moshed,
I've just installed bettertouchtool. I'll try to figure this out once and for all ;)
Hi Moshed, do you use my latest version? I've added a 'find' command a few weeks back to search for jq in /usr/local/bin, just in case it's not in PATH. It can be found here: https://github.com/davidem/shpotify/tree/3.0. Its changes have not yet been merged.
When I use bettertouchtool + my version of shpotify, it works like a charm. Note that 'list devices' also requires jq. If I disable 'find' in the script, it fails with the same error you get.
it works! great news!
thanks so much!
I've made options to list and play on other devices, like phones, computers, spotify connect devices, the like. It's using the authorisation part also used for listing one's playlists. Please note that i've added a few extra 'scopes', which means a possible existing 'refresh-token' needs to be removed.
Use
list devices
to list possible devices. Devices must be active, there's currently no history. It poops out the device id, name, type, used and volume level.Use
connect <device_id>
to select and play on a device. To connect by 'name' does not work (yet)What do you think? :)