NextFire / apple-music-discord-rpc

🎵 Discord Rich Presence Client for the macOS Apple Music app and iTunes
MIT License
598 stars 39 forks source link

Add retry method for iTunes API requests #103

Closed shiibe closed 2 months ago

shiibe commented 3 months ago

Hi! It's me again 😅

This PR just adds an enhancement to my last one. This will attempt to hit the iTunes API up to 3 times if it fails before falling back to MusicBrainz for artwork.

I'm still trying to get to the bottom of why the iTunes API will sometimes return "Service Unavailable", but after some tests it does seem to go through on the second attempt each time it happens.

Apologies for all of the commits, I had a hard time getting my fork up to date. 😓

NextFire commented 2 months ago

Is it something that happens often, or is the iTunes API just struggling from time to time?

shiibe commented 2 months ago

Is it something that happens often, or is the iTunes API just struggling from time to time?

I use this at work (listening 6-8 hours a day) and it happens ~5-10 times. The immediate fallback to MB works fine, but it's always nice to have the actual data from iTunes. I've been testing this for a few days now, and every time it's successfully grabbed the data from the API on the second attempt.

I'm still trying to get to the bottom of what's causing the error on the API side of things when I have time.

NextFire commented 2 months ago

Oops, sorry I messed up my push, I wanted to rebase your branch

Can you apply this patch on your fork to reopen this pr? Thanks 0001-Add-retry-method-to-iTunes-API-request.patch

curl -L https://github.com/user-attachments/files/16820569/0001-Add-retry-method-to-iTunes-API-request.patch | git am

NextFire commented 2 months ago

Oh well, don't bother, I will just commit the change directly on this repo

NextFire commented 2 months ago

https://github.com/NextFire/apple-music-discord-rpc/commit/609179fdf28611facceb6b58a245a9b51ef1456d

shiibe commented 2 months ago

Thank you! 😄