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

Apple Music service assumes albums always have certain properties #725

Open
KiruPoruno opened this issue Dec 3, 2024 · 2 comments
Open

Comments

@KiruPoruno
Copy link

KiruPoruno commented Dec 3, 2024

While playing around with this tool, I came across a persistent error:

Checking directory permissions...[done]
[https://music.apple.com/us/album/an-infinite-regression/478776210?i=467902919]
 [•] Identifying service...[Apple Music]
 [•] Checking authentication...[authenticated]
 Detected [track]
 Obtaining track metadata...(failed: [Cannot read properties of undefined (reading '0')])
 [i] An error occurred while processing the query

And it took a bit to realize $SHOW_DEBUG_STACK was a thing, but once that was the case it was easy to track down the issue:

[TypeError: Cannot read properties of undefined (reading '0')
    at AppleMusic.wrapTrackMeta (src/services/apple_music.js:166:38)
    at src/services/apple_music.js:315:21]

The issue stems from the Apple Music service assuming that all tracks have an artist set on the album, this isn't the case, as I realized, although rare, it does occur (as shown with the track in the logs), and the albumInfo.artists will in such a case just be undefined

Edit: After fixing the above locally, this also happens with albumInfo.tracks.reduce() a couple lines down...

@KiruPoruno KiruPoruno changed the title Apple Music service assumes tracks have an album artist Apple Music service assumes album have an album artist and track list Dec 3, 2024
@KiruPoruno KiruPoruno changed the title Apple Music service assumes album have an album artist and track list Apple Music service assumes albums always have certain properties Dec 3, 2024
@miraclx
Copy link
Owner

miraclx commented Jan 6, 2025

Hi @KiruPoruno, thanks for filing. Cases like these are difficult to preempt, as their potential absence is undocumented in the API and it just "makes sense" for it not to be optional.

I'll find some time to patch this, thanks for providing the link.

@allinduetime
Copy link

allinduetime commented Feb 23, 2025

I'm unsure if this is the exact same problem but it seems i'm having a similar issue

[https://music.apple.com/us/playlist/zzz-all-songs/pl.u-mJy8150Cz7mR3dB]
 [•] Identifying service...[Apple Music]
 [•] Checking authentication...[authenticated]
 Detected [playlist]
 Obtaining playlist metadata...[done]
  ➤ Playlist Name: zzz all songs
  ➤ By: Angel Thomas
  ➤ Type: User,Shared
  ➤ Tracks: 7416
 [•] Collating...
  [•] Inquiring tracks...(failed: [Cannot read properties of undefined (reading '0')])
 [i] An error occurred while processing the query (Failed to collect playlist tracks) 

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

No branches or pull requests

3 participants