gdi3d / mute-spotify-ads-mac-osx

Mute Mac (osx) computer audio when Spotify plays an AD
https://gdi3d.github.io/mute-spotify-ads-mac-osx/
MIT License
120 stars 17 forks source link

Spotify ads playing after MacOS Ventura 13.0 update #31

Closed ed97m closed 1 year ago

ed97m commented 1 year ago

Ads now play on Spotify, this started after the most recent MacOS update. 13.0 Ventura, I really like using this script. Thanks for making it :)

ed97m commented 1 year ago

More information. The terminal information does not display any errors, even when reinstalling and running the script the ads play. Screenshot 2022-10-27 at 12 22 52

See screenshot below

gdi3d commented 1 year ago

Hey, I'm not running Ventura right now. You can help me debug it, but it's gonna be tricky.

If you want, try the following. Run this on your terminal with Spotify running:

log stream --process="mediaremoted" --predicate='eventMessage contains[cd] "spotify.client"' 

And try to send me the output generated at the time an AD shows up so I can see if anything has changed.

This is kind of the core of the whole script. It reads the events of Spotify and you can see what song is playing, in case of the ads, the albumName property returns empty and thats when I silence the app.

I'm not planning to upgrade to Ventura until December, sorry :(

Timekeeper0001 commented 1 year ago

Hi @gdi3d I tried to attach the output from terminal whilst the ads are running. Not sure if this was the attached properly

spotify ads ventura.txt

gdi3d commented 1 year ago

@Timekeeper0001 Hey, it worked fine. But I need a little more info.

Try the following:

  1. Run the same command again
  2. Play a song for 4 or 5 seconds and pause it.
  3. Copy and paste the log into the ticket

I belive this new version of OSX might be hidding the information needed for the script to work.

Timekeeper0001 commented 1 year ago

Hi @gdi3d Ran this 1 song for 4 seconds and stopped it. Had the spotify mute command in one terminal window. And the debugging command in another terminal window

spotify ads ventura2.txt

gdi3d commented 1 year ago

It looks like the log tool is not longer showing the information needed for the script to work. Maybe there's some extra config that could be added to the command to make it visible again.

I will be looking into this once I've updated to Ventura on December, and report any news in this ticket.

Timekeeper0001 commented 1 year ago

@gdi3d Thank you for your effort my friend. And if you cant get it resolved in the future, it was really good while it lasted. Though Ill keep my fingers crossed because the ads are awful lol. :)

dlijavetzky commented 1 year ago

Hi @gdi3d Thanks for the info and hope you can fix it soon!!!

david-mccullars commented 1 year ago

I dug into this a bit and saw that the album information is no longer being displayed. Without this the AD_REG and SONG_REG won't work. Instead of album I'm seeing <<private>>.

Fortunately, I found this link to be super helpful, and I believe it solves the problem. By installing the enable-unified-log-private-data profile I started seeing the private data, including album.

gdi3d commented 1 year ago

Hey @david-mccullars , thanks for sharing!.

I saw the same post a few days ago but I didn't have the time to test and research it.

I'm not too happy with the solution, since it requieres a certain level of knowledge and most of the user of the script are just regular user.

I'm currently testing other methods but no luck so far.

I'll keep this issue updated with any new findings and/or solutions.

gdi3d commented 1 year ago

I think I've a found a way 💪💪💪

I will be testing it the coming days, keep fingers cross everyone!

gdi3d commented 1 year ago

I've found a solution to fix the problem. It doesn't require any extra software to be installed.

I'll be testing it for a few days to make sure everything works ok before rolling the update.

The only drawback is that now it will take between 1 and 2 seconds to detect the ad/song and update the volume to the correct level.

bbbco commented 1 year ago

Since this is a Mac only version, you could consider using oascript to detect the ads using the following check

 osascript -e 'tell application "Spotify" to get spotify url of current track'

if ":ad:" is in the result, an ad is being played.

gdi3d commented 1 year ago

Since this is a Mac only version, you could consider using oascript to detect the ads using the following check

 osascript -e 'tell application "Spotify" to get spotify url of current track'

if ":ad:" is in the result, an ad is being played.

🤯🤯🤯🤯🤯🤯🤯🤯🤯 AWESOME!!!

bbbco commented 1 year ago

I know ;)

I've got a crude Applescript that does this. Yours is much more polished.

gdi3d commented 1 year ago

I've found the original docs for this on Spotify dev page (only available on wayback machine now https://web.archive.org/web/20170913123237/https://developer.spotify.com/applescript-api/).

I wasn't aware you had access to this using osascript 🙃.

I will give you credits on the commit and the posts announcing the version ;)

Can I post your twitter handle to give you credit?

bbbco commented 1 year ago

Sure, no problem! @bbbco is my handle here and on Twitter

gdi3d commented 1 year ago

The script is almost ready. I'll be launching the update on the weekend 🚀😀

gdi3d commented 1 year ago

New version launched!