Repository navigation
feat: add addedAt to GetPlaylist track edges - #59
Conversation
|
This is needed to support date-added sorting for playlists, which I've sent here: music-assistant/server#6455 and music-assistant/frontend#2824 Once this PR lands I can send the final glue in the backend to tie everything together. |
jdaberkow
left a comment
There was a problem hiding this comment.
Nice addition. Thanks! I have one thought though:
Date is currently an unmapped GraphQL custom scalar, so ariadne-codegen generates added_at as Any. This loses both static type safety and runtime type validation.
Could you map the scalar in pyproject.toml and regenerate the client?
[tool.ariadne-codegen.scalars.Date]
type = "str"Deezer's Date scalar is an ISO 8601 string, but unmapped, ariadne-codegen typed its fields as Any, losing both static type checking and pydantic's runtime validation. Map it to str in the codegen config and regenerate: every Date field in the generated models (favoritedAt, releaseDate, expiresAt, bookmarkedAt, and others) is now typed as str. A test checks that a non-string favoritedAt now fails validation.
Request when playlist tracks were added (PlaylistTracksEdge.addedAt),
exposed as added_at on GetPlaylistPlaylistTracksEdges. Deezer's apps
sort playlists, including Favorite tracks, by this ("Recently added")
by default; Music Assistant needs it to offer the same order.
The schema also offers server-side ordering (tracks(order: ADDED_AT_DESC)),
but the per-track date lets consumers sort either way and keep one cached
track list.
The existing recording predates this field, and the chart playlist it
captured has since changed, so the fixture's addedAt values were added by
hand in the format the live API returns.
Good call, thanks! Done: the PR now starts with 87dd991, which maps |
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Some streaming apps provide a `date added` item for tracks in a list, and this value is already present in the library. Expose this for play_media's "sort_by" so playlist ordered by add-time works so playlist ordering will match a given streaming app's ordering. **Related issue (if applicable):** - Make `date_added` available from Deezer: music-assistant/deezer-python-gql#59 - Set `date_added` from Deezer: #6457 - Frontend PR: music-assistant/frontend#2824 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives the label from the ticked box and applies it automatically; the release-notes generator uses that same label to slot this change into the next release notes. --> - [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [x] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [x] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.
|
Thanks. LGTM now. :) |
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Updates `track.date_added` from Deezer track lists so it can be sorted against. **Related issue (if applicable):** - Deezer provider side: music-assistant/deezer-python-gql#59 - Exposed via sorting: music-assistant#6455 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives the label from the ticked box and applies it automatically; the release-notes generator uses that same label to slot this change into the next release notes. --> - [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [x] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate. --------- Co-authored-by: Marvin Schenkel <marvinschenkel@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Request when playlist tracks were added (PlaylistTracksEdge.addedAt), exposed as added_at on GetPlaylistPlaylistTracksEdges. Deezer's apps sort playlists, including Favorite tracks, by this ("Recently added") by default; Music Assistant needs it to offer the same order.
The schema also offers server-side ordering (tracks(order: ADDED_AT_DESC)), but the per-track date lets consumers sort either way and keep one cached track list.
The existing recording predates this field, and the chart playlist it captured has since changed, so the fixture's addedAt values were added by hand in the format the live API returns.