gdi3d/mute-spotify-ads-mac-osx

45:51: execution error: The variable volume is not defined

Closed this issue · 8 comments

As the title suggests, when running the shell script & updating from CLI, I get the following output:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5672  100  5672    0     0  89126      0 --:--:-- --:--:-- --:--:--  106k
Update finish. 🥳
45:51: execution error: The variable volume is not defined. (-2753)

I'm inclined to think it's something on my end, but figured I'd reach out and see if this was something you were aware of.

For reference:

  • Spotify Desktop app (had been working for years -- thank you for this!)
  • Monterey 12.6.2, M1 chip

Happy to provide whatever additional information you'd like 🙇‍♂️

gdi3d commented

Hi, I'll check the code to see if I can reproduce the error and fix it.

What happens when you run the script manually after being updated?

gdi3d commented

Closing the ticket due to inactivity and not being able to reproduce the error.

Apologies for not circling back sooner (got lost in the shuffle). The issue is still there:
muteSpotify

I hope that helps @gdi3d because I really do love this utility (and hate spotify ads lol)

gdi3d commented

Hey!, its quite strange to be honest. Because there's no variable named volume.

The only place where the volume keyword is present is when osascript is called.

Try the following:

  • run osascript -e 'tell application "Spotify" to set A to sound volume' with spotify closed (should return 0)
  • run osascript -e 'tell application "Spotify" to set A to sound volume' with spotify open (should return the volumen set in the app 0/100)
  • run the script without zsh or similar shells, just plain old regular bash

The only place where the volume keyword is present is when osascript is called.
Try the following:

  • run osascript -e 'tell application "Spotify" to set A to sound volume' with spotify closed (should return 0)
    This does return 0
  • run osascript -e 'tell application "Spotify" to set A to sound volume' with spotify open (should return the volumen set in the app 0/100)
    This does return 58 (presumably since my volume is at about halfway)

And I swear to you, as a Senior Dev at a respected company, I am not incompetent. But running these scripts, and then I thought, hey, let me try running the ads-muter program again. And it just worked.

My guess, knowing absolutely nothing of what you've written, is that I got my Spotify or terminal into a weird state mid-some-script. And these commands shook something loose and reset some state.

Or maybe I'm totally wrong. Regardless, I'm happy because this worked and you fixed my issue. THANK YOU <3

gdi3d commented

That's good news!. I'm glad it works ok now! Let's hope it was just a glitch

Hey! I got this error in mac Ventura. I closed Spotify and run it first before Spotify, then it worked!

gdi3d commented

Thanks for the report!