Skip to content
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

Retry iTunes album art retrieval #478

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hexawyz
Copy link

@hexawyz hexawyz commented Oct 23, 2021

Hi,

When using Snip with iTunes, I noticed that it would sometimes fail to retrieve the Album Artwork on some tracks. However, pausing, and playing again, the album art would be retrieved properly.
I suspect this to be caused by some delays retrieving the Album artwork in iTunes itself.

This change introduces a retry mechanism (retry every 100ms for 5s) for the Album Artwork, in the hope that this will be enough for iTunes to retrieve the album artwork. I ran snip with this change for a bit and did not notice empty album art anymore, so I expect it to be enough.

Note 1: If a track is played directly from Apple Music (i.e. not from the iTunes library), the album art will never be retrieved at all. That seems to be a limitation of the iTunes COM API.
Note 2: For those wanting to run with this change and use the Store version of iTunes, Snip need to be modified to not run as Administrator. (It seems that elevated processes cannot access PackagedCOM, so the easiest solution is to not run elevated)

@dlrudie
Copy link
Owner

dlrudie commented Feb 12, 2022

Interesting. I can't say I've ever seen Snip fail to get the artwork from iTunes. Also I have not looked into streaming from Apple Music and retrieving the artwork. I feel like Apple hasn't really updated the COM library to account for a lot of the newer functionality within iTunes. There may be something in there for it but I'd have to look.

I've reviewed the code and I appreciate the contribution, but I'm not sure I like the idea of having to retry to get the artwork. It's been a long time since I looked at the API. I'm wondering when fetching the artwork if it has any other kind of return that will let you know whether it was successful or not.

Could it also be resolved by potentially just adding an initial 1-2 second delay before trying to pull the artwork? If a delay will allow it to get it 100% of the time then maybe a retry isn't needed.

Lastly, I wonder how this will affect a file that doesn't have any artwork at all. While there is a cutoff point for the retry it would be unnecessary to keep retrying if the file doesn't have artwork.

I'll try to get to testing this either this weekend or next weekend.

Again, I appreciate the contribution! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants