rryam / MusadoraKit

The ultimate companion to MusicKit.
http://exploringmusickit.com
MIT License
345 stars 22 forks source link

Cannot find library song with MPMediaItem playbackStoreID #12

Closed aeip closed 2 years ago

aeip commented 2 years ago

I'm trying to convert a list of MPMediaItems to their cloud version but am I getting the following error from the below code:

The specified music item could not be found for 1631024269.

Code:

@State var songs = [MPMediaItem]()

            let list = songs[0...19].map { MusicItemID(stringLiteral: $0.playbackStoreID) }
            let testSongs = try await MusadoraKit.librarySong(id: list[0])
            print(testSongs.title)

I feel like it should work because MusadoraKit.librarySong(id: ) takes a MusicItemID. And I have received that from an MPMediaItem's playbackStoreID.

Am I just searching with the wrong function from Musadora Kit? Thank you

rudrankriyam commented 2 years ago

1631024269 is a MusicItemID for a song in the Apple Music catalogue, not a user's library one. Library one is like i.gelNOzPuL41Lxo or something similar but with characters

rudrankriyam commented 2 years ago

Can you try the MusadoraKit.catalogSong(id:) instead? Does that work? Because playbackStoreID as far as I remember is the catalog ID

aeip commented 2 years ago

Can you try the MusadoraKit.catalogSong(id:) instead? Does that work? Because playbackStoreID as far as I remember is the catalog ID

Yes that works perfectly!