Post

Replies

Boosts

Views

Activity

Reply to How to get a catalog playlists of a curator?
I'm hopeful, that the blow may work, but I'm waiting on an iOS16 device to test on: @available(iOS 16.0, *) func getCuratorPlaylistsFromPlaylist2(playlistId: String) async throws -> String? {     do {         var request = MusicCatalogResourceRequest<MusicKit.Playlist>(matching: \.id, equalTo: MusicItemID(playlistId))         request.properties = [.curator] // adding curator to the request         let response = try await request.response()         Logger.log(.success, "Playlists Response: \(response.items)") // this is a collection of playlists, as expected.         Logger.log(.info, "Playlists Item Count: \(response.items.count)") // this is always 1, as expected         for item in response.items {             Logger.log(.info, "Item: \(item)") // shows the playlist's id, name, curatorName, and maybe more with .curator added             Logger.log(.info, "Type of Item: \(type(of: item))") // type is Playlist             if let curatorPlaylists = item.curator?.playlists {                 Logger.log(.info, "Curator Playlists: \(curatorPlaylists)") // hopeful here!             } else {                 Logger.log(.warning, "No Curator Playlists!")             }         }     } catch {         // handle error         Logger.log(.error, "Could not findCuratorOfPlaylist \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Jun ’22
Reply to How to get a catalog playlists of a curator?
Can't seem to do this either, using the curatorName that can be found in either of the two above attempts. @available(iOS 15.4, *) func searchForCurator(name: String) async throws -> MusicItemCollection<Curator>? {     do {         Logger.log(.error, "Doing search for curator by name...")         let request = MusicCatalogSearchRequest(term: name, types: [Curator.self])         let response = try await request.response()         Logger.log(.info, "Response curators: \(response.curators)") // MusicItemCollection<Curator>()         Logger.log(.info, "Response curators isEmpty: \(response.curators.isEmpty)") // true     } catch {         // handle error     Logger.log(.error, "Could not searchForCurator \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Jun ’22
Reply to How to get a catalog playlists of a curator?
Here's something similar to the above, but using .moreByCurator, though I'm not sure if I'm using it right, as I never get results. @available(iOS 15.4, *) func getCuratorPlaylistsFromPlaylist(playlistId: String) async throws -> String? {     do {         let request = MusicCatalogResourceRequest<MusicKit.Playlist>(matching: \.id, equalTo: MusicItemID(playlistId)) //catalogId         let response = try await request.response()         Logger.log(.success, "Playlists Response: \(response.items)") // this is a collection of playlists, as expected.         Logger.log(.info, "Playlists Item Count: \(response.items.count)") // this is always 1, as expected         for item in response.items {             Logger.log(.info, "Item: \(item)") // shows the playlist's id, name, and curatorName             Logger.log(.info, "Type of Item: \(type(of: item))") // type is Playlist             let morePlaylists = item.moreByCurator // not sure this is the right way to use .moreByCurator             Logger.log(.info, "More Playlists: \(String(describing: morePlaylists))") // This is always nil!         }     } catch {         // handle error         Logger.log(.error, "Could not findCuratorOfPlaylist \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Jun ’22
Reply to How to get a catalog playlists of a curator?
Trying some more things, admittedly not knowing what I'm doing: This still requires me to know the catalogId of a playlist that exists as a catalog resource, but it get's me the curatorId, which seems hopeful. My problem is searching for the curator using a MusicCatalogResourceRequest yields no results. func findCuratorOfPlaylist(playlistId: String) async throws -> String? {     do {         var requestURLComponents = URLComponents()         requestURLComponents.scheme = "https"         requestURLComponents.host = "api.music.apple.com"         requestURLComponents.path = "/v1/catalog/us/playlists/\(playlistId)/curator" // Got this idea from @snuff4         if let url = requestURLComponents.url {             let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: url))             let dataResponse = try await dataRequest.response()             let decoder = JSONDecoder()             let response = try decoder.decode(AppleMusicGetCuratorResponse.self, from: dataResponse.data)             Logger.log(.info, "Curator Response: \(response)") // this returns the id, name, and kind (.editorial)             let items = response.data             let id = items[0].id             Logger.log(.info, "Searching for Curator with ID of \(id)")             let request = MusicCatalogResourceRequest<Curator>(matching: \.id, equalTo: id)             let resp = try await request.response()             Logger.log(.info, "Find Curator Request Response Items: \(resp.items)") // MusicCatalogResourceResponse<Curator>()             Logger.log(.info, "Is Curator Request Response empty: \(resp.items.isEmpty)") // true         }     } catch {         // handle error         Logger.log(.error, "Could not findCuratorOfPlaylist \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Jun ’22
Reply to Songs are not always added to Playlist when using Music iOS
This is wild. For the first time in an exceptionally long time, I actually got a response on the Feedback Assistant regarding an issue I opened (thanks @JoeKun!). They wanted me to reproduce the problem, which I had painstakingly done in text in the ticket. Regardless, I decided to make a screen cast of the issue, so as to illustrate the issue, and... The problem is magically gone! I do need to say that this WAS a problem, and I swear it was still happening within the last month (I've been busy on other stuff, so I can't be sure of when it last didn't work). That said, @dutton, can you please check on your side to see if this issue has been resolved? Much appreciated! Imma gonna keep testing, but if this keeps working, I'll close this issue once confirmed.
Topic: Media Technologies SubTopic: General Tags:
Jun ’22
Reply to Missing play parameters when trying to play with MusicKit - potential storefront issue
I have confirmed that the behavior is related to country/storefront by programatically saving the offending track to a playlist in Apple Music and attempting to play it there. The result of that is an alert that says, "This song is not currently available in your country or region." So my quesiton still stands: "How can I create a MusicCatalogRequest in such a way that I only get results that are playable in my country/storefront?"
Topic: Media Technologies SubTopic: General Tags:
Feb ’22
Reply to Run async tasks using Background Tasks
Hi @eskimo, Thanks for the pro follow up. That is correct. To clarify further, getUpdateAppData() function is run after manually invoking the objc command in Xcode. I don't actually know of another way to test this. The task is initially registered with the configureBackgroundTasks() function (see last code block in my prior post) in the init function of the app's app file (not app delegate). Kindly let me know if you have any further questions.
Topic: App & System Services SubTopic: Core OS Tags:
Dec ’21
Reply to Editing a Library Playlist (MusicKit: iOS 16 beta)
As a follow up, the following does work: for track in tracksToAdd { try await MusicLibrary.shared.add(track, to: targetPlaylist) } However, this is adding, not editing. The thing is that I’m really interested in the edit functionality, so as to be able to remove tracks.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Editing a Library Playlist (MusicKit: iOS 16 beta)
Thanks @david-apple, I've raised a ticket (FB10328182) on Feedback Assistant as you've suggested.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to get a catalog playlists of a curator?
I'm hopeful, that the blow may work, but I'm waiting on an iOS16 device to test on: @available(iOS 16.0, *) func getCuratorPlaylistsFromPlaylist2(playlistId: String) async throws -> String? {     do {         var request = MusicCatalogResourceRequest<MusicKit.Playlist>(matching: \.id, equalTo: MusicItemID(playlistId))         request.properties = [.curator] // adding curator to the request         let response = try await request.response()         Logger.log(.success, "Playlists Response: \(response.items)") // this is a collection of playlists, as expected.         Logger.log(.info, "Playlists Item Count: \(response.items.count)") // this is always 1, as expected         for item in response.items {             Logger.log(.info, "Item: \(item)") // shows the playlist's id, name, curatorName, and maybe more with .curator added             Logger.log(.info, "Type of Item: \(type(of: item))") // type is Playlist             if let curatorPlaylists = item.curator?.playlists {                 Logger.log(.info, "Curator Playlists: \(curatorPlaylists)") // hopeful here!             } else {                 Logger.log(.warning, "No Curator Playlists!")             }         }     } catch {         // handle error         Logger.log(.error, "Could not findCuratorOfPlaylist \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to get a catalog playlists of a curator?
Can't seem to do this either, using the curatorName that can be found in either of the two above attempts. @available(iOS 15.4, *) func searchForCurator(name: String) async throws -> MusicItemCollection<Curator>? {     do {         Logger.log(.error, "Doing search for curator by name...")         let request = MusicCatalogSearchRequest(term: name, types: [Curator.self])         let response = try await request.response()         Logger.log(.info, "Response curators: \(response.curators)") // MusicItemCollection<Curator>()         Logger.log(.info, "Response curators isEmpty: \(response.curators.isEmpty)") // true     } catch {         // handle error     Logger.log(.error, "Could not searchForCurator \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to get a catalog playlists of a curator?
Here's something similar to the above, but using .moreByCurator, though I'm not sure if I'm using it right, as I never get results. @available(iOS 15.4, *) func getCuratorPlaylistsFromPlaylist(playlistId: String) async throws -> String? {     do {         let request = MusicCatalogResourceRequest<MusicKit.Playlist>(matching: \.id, equalTo: MusicItemID(playlistId)) //catalogId         let response = try await request.response()         Logger.log(.success, "Playlists Response: \(response.items)") // this is a collection of playlists, as expected.         Logger.log(.info, "Playlists Item Count: \(response.items.count)") // this is always 1, as expected         for item in response.items {             Logger.log(.info, "Item: \(item)") // shows the playlist's id, name, and curatorName             Logger.log(.info, "Type of Item: \(type(of: item))") // type is Playlist             let morePlaylists = item.moreByCurator // not sure this is the right way to use .moreByCurator             Logger.log(.info, "More Playlists: \(String(describing: morePlaylists))") // This is always nil!         }     } catch {         // handle error         Logger.log(.error, "Could not findCuratorOfPlaylist \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to get a catalog playlists of a curator?
Trying some more things, admittedly not knowing what I'm doing: This still requires me to know the catalogId of a playlist that exists as a catalog resource, but it get's me the curatorId, which seems hopeful. My problem is searching for the curator using a MusicCatalogResourceRequest yields no results. func findCuratorOfPlaylist(playlistId: String) async throws -> String? {     do {         var requestURLComponents = URLComponents()         requestURLComponents.scheme = "https"         requestURLComponents.host = "api.music.apple.com"         requestURLComponents.path = "/v1/catalog/us/playlists/\(playlistId)/curator" // Got this idea from @snuff4         if let url = requestURLComponents.url {             let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: url))             let dataResponse = try await dataRequest.response()             let decoder = JSONDecoder()             let response = try decoder.decode(AppleMusicGetCuratorResponse.self, from: dataResponse.data)             Logger.log(.info, "Curator Response: \(response)") // this returns the id, name, and kind (.editorial)             let items = response.data             let id = items[0].id             Logger.log(.info, "Searching for Curator with ID of \(id)")             let request = MusicCatalogResourceRequest<Curator>(matching: \.id, equalTo: id)             let resp = try await request.response()             Logger.log(.info, "Find Curator Request Response Items: \(resp.items)") // MusicCatalogResourceResponse<Curator>()             Logger.log(.info, "Is Curator Request Response empty: \(resp.items.isEmpty)") // true         }     } catch {         // handle error         Logger.log(.error, "Could not findCuratorOfPlaylist \(error)")     }     return nil }
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Adding tracks to User's Library Playlist
Thanks for the pro follow-up, @JoeKun. I've been dabbling, and it looks like add(to:) is singular, while edit would allow me to achieve my use case. Nice to see these new features coming to MusicKit!
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Songs are not always added to Playlist when using Music iOS
FYI: @dutton @JoeKun, After testing, the problem still exists, and I've updated FB9857866 accordingly.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Delete song from playlist using Music Kit JS (or the API)?
UPDATE! It appears that this is now possible. See here!
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Can we remove tracks from a user's Library Playlist yet?
@david-apple This is great! I'm so happy that this feature is now available... it's been a long time coming. It appears that I need to target iOS16, which means I gotta update my test device, which is an iPod touch generation 7. I look forward to getting into this soon.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Can we remove tracks from a user's Library Playlist yet?
@david-apple Awesome! Does this mean that only playlists created with the new [createPlaylist](@david-apple Awesome!) function are editable, or can playlists created via the Apple Music API also be edited? Thanks, Kim
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Songs are not always added to Playlist when using Music iOS
This is wild. For the first time in an exceptionally long time, I actually got a response on the Feedback Assistant regarding an issue I opened (thanks @JoeKun!). They wanted me to reproduce the problem, which I had painstakingly done in text in the ticket. Regardless, I decided to make a screen cast of the issue, so as to illustrate the issue, and... The problem is magically gone! I do need to say that this WAS a problem, and I swear it was still happening within the last month (I've been busy on other stuff, so I can't be sure of when it last didn't work). That said, @dutton, can you please check on your side to see if this issue has been resolved? Much appreciated! Imma gonna keep testing, but if this keeps working, I'll close this issue once confirmed.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Songs are not always added to Playlist when using Music iOS
@JoeKun, thanks for following up. I think maybe mentions in comments don't send notifications. Not sure. Anyhow, please keep me posted, and this is still an issue as of recently.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Missing play parameters when trying to play with MusicKit - potential storefront issue
I have confirmed that the behavior is related to country/storefront by programatically saving the offending track to a playlist in Apple Music and attempting to play it there. The result of that is an alert that says, "This song is not currently available in your country or region." So my quesiton still stands: "How can I create a MusicCatalogRequest in such a way that I only get results that are playable in my country/storefront?"
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to Run async tasks using Background Tasks
Hi @eskimo, Thanks for the pro follow up. That is correct. To clarify further, getUpdateAppData() function is run after manually invoking the objc command in Xcode. I don't actually know of another way to test this. The task is initially registered with the configureBackgroundTasks() function (see last code block in my prior post) in the init function of the app's app file (not app delegate). Kindly let me know if you have any further questions.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’21