Before you begin
What happened?
What happened?
Sorting the library by "recently added" does not work for Apple Music. Every playlist gets its Music Assistant import time as timestamp_added instead of the date it was actually added to the Apple Music library, so the order is meaningless (it degrades to alphabetical / import-batch order).
Apple does expose the data. Calling the same endpoint MA uses, with the documented extend parameter, returns dateAdded on library playlists:
GET https://amp-api.music.apple.com/v1/me/library/playlists?extend=dateAdded
→ "Billie Eilish Essentials": { "dateAdded": "2024-02-25T15:01:08Z", ... }
dateAdded is a documented LibraryPlaylists attribute, marked not-required, so it is only returned when requested via extend. (Playlists added before ~2016 legitimately have no dateAdded — those are unavoidable.) The same gap affects library albums (me/library/albums also supports extend=dateAdded).
What I already tried (to save you the dead ends)
On 2.10.2 I patched the provider locally:
- Added
extend="dateAdded" to the me/library/playlists and me/library/albums requests in providers/apple_music/library.py.
- Added a
_set_date_added() helper (mirroring the Tidal provider) reading item["attributes"]["dateAdded"] into media_item.date_added, for each yielded playlist/album.
get_library_playlists() then yields playlists with date_added set correctly — but the value is still lost by the time the row is written: a removed + re-synced playlist comes back with today's timestamp, not its real dateAdded.
Tracing it: MusicController.add_item_to_library() re-fetches the item via get_item() → provider.get_playlist() → _get_regular_playlist(), which never sets date_added (and for hasCatalog/editorial playlists reads the catalog endpoint, which has no dateAdded at all). So the date_added the sync generator set is discarded on the re-fetch.
- I then patched
add_item_to_library() to carry the caller's date_added onto the re-fetched item. It still comes back insert-time — so the value is dropped at a further point I could not pin from outside the running process.
Also: for existing rows, _library_item_needs_update() doesn't treat a date_added change as update-worthy, so a normal re-sync never backfills dates onto playlists already in the library.
How to reproduce
Music Assistant version
2.10.2 (Home Assistant add-on, Python 3.14)
How to reproduce
- Add the Apple Music provider, let the library sync.
- Sort the playlist library by "recently added".
- Order reflects sync/import time, not Apple's
dateAdded. Confirm via the API call above that Apple returns real, differing dateAdded values for the same playlists.
Music Assistant version
2.10.2 (Home Assistant add-on, Python 3.14)
How do you run Music Assistant?
Home Assistant add-on
Diagnostics report or log file
music-assistant-diagnostics-2026-09-06-130515.json
Anything else?
No response
Before you begin
What happened?
What happened?
Sorting the library by "recently added" does not work for Apple Music. Every playlist gets its Music Assistant import time as
timestamp_addedinstead of the date it was actually added to the Apple Music library, so the order is meaningless (it degrades to alphabetical / import-batch order).Apple does expose the data. Calling the same endpoint MA uses, with the documented
extendparameter, returnsdateAddedon library playlists:dateAddedis a documentedLibraryPlaylistsattribute, marked not-required, so it is only returned when requested viaextend. (Playlists added before ~2016 legitimately have nodateAdded— those are unavoidable.) The same gap affects library albums (me/library/albumsalso supportsextend=dateAdded).What I already tried (to save you the dead ends)
On 2.10.2 I patched the provider locally:
extend="dateAdded"to theme/library/playlistsandme/library/albumsrequests inproviders/apple_music/library.py._set_date_added()helper (mirroring the Tidal provider) readingitem["attributes"]["dateAdded"]intomedia_item.date_added, for each yielded playlist/album.get_library_playlists()then yields playlists withdate_addedset correctly — but the value is still lost by the time the row is written: a removed + re-synced playlist comes back with today's timestamp, not its realdateAdded.Tracing it:
MusicController.add_item_to_library()re-fetches the item viaget_item()→provider.get_playlist()→_get_regular_playlist(), which never setsdate_added(and forhasCatalog/editorial playlists reads the catalog endpoint, which has nodateAddedat all). So thedate_addedthe sync generator set is discarded on the re-fetch.add_item_to_library()to carry the caller'sdate_addedonto the re-fetched item. It still comes back insert-time — so the value is dropped at a further point I could not pin from outside the running process.Also: for existing rows,
_library_item_needs_update()doesn't treat adate_addedchange as update-worthy, so a normal re-sync never backfills dates onto playlists already in the library.How to reproduce
Music Assistant version
2.10.2 (Home Assistant add-on, Python 3.14)
How to reproduce
dateAdded. Confirm via the API call above that Apple returns real, differingdateAddedvalues for the same playlists.Music Assistant version
2.10.2 (Home Assistant add-on, Python 3.14)
How do you run Music Assistant?
Home Assistant add-on
Diagnostics report or log file
music-assistant-diagnostics-2026-09-06-130515.json
Anything else?
No response