-
-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exit with 1 if Spotify isn't actually started #117
base: main
Are you sure you want to change the base?
Conversation
Hmm, I am not sure I agree. |
I'd say |
Again, I am not sure I agree. I do agree with your narrow case in the issue where |
Your argument is understandable. What would you think should be the right behaviour for
|
Exit 0. So we need to figure out how to do this in a way that is right for each command, and I am guessing spotify play (and its variants) is the only case where we want it to magic start. |
I can agree to that :) I'll see if I can whip something up on the weekend. |
Thank you 👍 |
Would a good compromise be to include something like an # original line: https://github.com/hnarayanan/shpotify/blob/c93a1e939a7f3260fefe8ed2537733c89d88caee/spotify#L29
USER_CONFIG_DEFAULTS="CLIENT_ID=\"\"\nCLIENT_SECRET=\"\"\nSPOTIFY_AUTOSTART=1"; and # https://github.com/hnarayanan/shpotify/blob/c93a1e939a7f3260fefe8ed2537733c89d88caee/spotify#L153-L156
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
if [ "$SPOTIFY_AUTOSTART" -eq 0 ]; then
echo "Spotify not starting automatically. Exiting."
exit 1
fi
osascript -e 'tell application "Spotify" to activate' || exit 1
sleep 2
fi Note the default is to autostart spotify (author's preference), but in this way a user can choose to explicitly have to open Spotify. |
From what I can tell, the following lines are unnecessary:
Spotify does NOT need to be running in order for it to respond to apple script requests; it will launch automatically and respond to the apple script. I suggest that you remove this section. Also, with this section included, if Spotify is not running before I enter a command, when I run a command it will launch and become the frontmost application. I don't like having the Spotify window launch and filling up my screen when I can just control it from the command line. After commenting out the above section, when I run a command, Spotify launches, but stays hidden. If, for some reason, I'm wrong, at the very least Spotify can be launched hidden via the following terminal command: Edit: some more info about |
Please look up |
I'd forgotten but apparently that was me to solve #73 @Peter-Schorn i added that line at some point to address the (admittedly odd) edge case of a weird error message if Spotify.app wasn't installed at all. I think your |
I just created a python script that allows you to play Spotify songs directly from spotlight search on macOS! Check it out here |
Starting Spotify - if it's not actually started - is magic, and should only be done explicitly.
Thus, this PR changes starting Spotify.app via
osascript
to printing the according error and exiting with 1.Adresses #114