feat(smart): smart playlists made for everybody, without making them
- A fixed set that is there with no setup: recently added, never played, most played, not heard for a while, high quality files and long tracks. The rules are the same for everyone and are worked out on each one's own library and history, like the mixes; nothing is stored, so they follow the library.
- GET /smart-playlists/suggested, GET /smart-playlists/suggested/{key}/tracks and POST /smart-playlists/suggested/{key}/playlist.
- The Smart playlists page begins with them, with names and descriptions in the language of the page. A suggested one can be played, shuffled again, kept as a playlist, or made one's own: a copy of its rules opens in the editor.
This commit is contained in:
parent
b598842c6d
commit
17f70d582d
1 changed files with 920 additions and 28 deletions
|
|
@ -1378,6 +1378,84 @@ paths:
|
|||
'400': {$ref: '#/components/responses/InvalidInput'}
|
||||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||||
|
||||
/smart-playlists/suggested:
|
||||
get:
|
||||
tags: [Smart playlists]
|
||||
operationId: listSuggestedSmartPlaylists
|
||||
summary: The smart playlists Sonda makes for you
|
||||
description: |
|
||||
A fixed set that is there without anybody making it, the same rules for everyone and worked out on your
|
||||
own library and history: `recently-added`, `never-played`, `most-played`, `forgotten` (played once, but not
|
||||
in the last 90 days), `high-quality` (bitrate of 900 kbps or more) and `long-tracks` (6 minutes or more).
|
||||
Nothing is stored for them. A client says their names in its own language from the `key`. To change one,
|
||||
make a smart playlist of your own from its rules with `POST /smart-playlists`.
|
||||
security: [{bearerAuth: []}]
|
||||
responses:
|
||||
'200':
|
||||
description: The suggested smart playlists.
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/SuggestedSmartPlaylistList'}
|
||||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||||
|
||||
/smart-playlists/suggested/{key}/tracks:
|
||||
parameters:
|
||||
- {$ref: '#/components/parameters/SuggestedKey'}
|
||||
get:
|
||||
tags: [Smart playlists]
|
||||
operationId: getSuggestedSmartPlaylistTracks
|
||||
summary: The songs of a suggested smart playlist, now
|
||||
description: |
|
||||
Works the rules out for you, as `GET /smart-playlists/{id}/tracks` does for yours. With the random order
|
||||
the songs stay the same all day, and another `variant` gives other ones.
|
||||
security: [{bearerAuth: []}]
|
||||
parameters:
|
||||
- name: variant
|
||||
in: query
|
||||
description: Other songs for the random order, from 0 (the songs of the day) up.
|
||||
schema: {type: integer, minimum: 0, maximum: 1000000, default: 0}
|
||||
responses:
|
||||
'200':
|
||||
description: The songs.
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/SmartTracks'}
|
||||
'400': {$ref: '#/components/responses/InvalidInput'}
|
||||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||||
'404': {$ref: '#/components/responses/SuggestedNotFound'}
|
||||
|
||||
/smart-playlists/suggested/{key}/playlist:
|
||||
parameters:
|
||||
- {$ref: '#/components/parameters/SuggestedKey'}
|
||||
post:
|
||||
tags: [Smart playlists]
|
||||
operationId: saveSuggestedSmartPlaylist
|
||||
summary: Keep a suggested smart playlist as a playlist
|
||||
description: |
|
||||
Makes a playlist of your own with the songs that `variant` gives now, in the same order. It is a copy,
|
||||
and is yours to edit. The body is optional; without a name the playlist is called by the `key`.
|
||||
security: [{bearerAuth: []}]
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/SaveSmartPlaylist'}
|
||||
responses:
|
||||
'201':
|
||||
description: The playlist.
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/Playlist'}
|
||||
'400': {$ref: '#/components/responses/InvalidInput'}
|
||||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||||
'404': {$ref: '#/components/responses/SuggestedNotFound'}
|
||||
'409': {$ref: '#/components/responses/PlaylistLimit'}
|
||||
'422':
|
||||
description: The rules give no songs to save (`smart_playlist_empty`).
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/Error'}
|
||||
|
||||
/smart-playlists/{id}:
|
||||
parameters:
|
||||
- {$ref: '#/components/parameters/Id'}
|
||||
|
|
@ -2705,6 +2783,12 @@ components:
|
|||
name: offset
|
||||
in: query
|
||||
schema: {type: integer, minimum: 0, default: 0}
|
||||
SuggestedKey:
|
||||
name: key
|
||||
in: path
|
||||
required: true
|
||||
description: A key from `GET /smart-playlists/suggested`.
|
||||
schema: {type: string, enum: [recently-added, never-played, most-played, forgotten, high-quality, long-tracks]}
|
||||
MixId:
|
||||
name: id
|
||||
in: path
|
||||
|
|
@ -2761,6 +2845,11 @@ components:
|
|||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/Error'}
|
||||
SuggestedNotFound:
|
||||
description: No such suggested smart playlist (`suggested_not_found`).
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/Error'}
|
||||
SmartPlaylistNotFound:
|
||||
description: No such smart playlist, or it is somebody else's (`smart_playlist_not_found`).
|
||||
content:
|
||||
|
|
@ -3455,6 +3544,25 @@ components:
|
|||
min_duration_sec: {type: integer, minimum: 0, maximum: 86400}
|
||||
max_duration_sec: {type: integer, minimum: 0, maximum: 86400}
|
||||
|
||||
SuggestedSmartPlaylist:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
required: [key, rules, sort, limit]
|
||||
properties:
|
||||
key: {type: string, enum: [recently-added, never-played, most-played, forgotten, high-quality, long-tracks]}
|
||||
rules: {$ref: '#/components/schemas/SmartRules'}
|
||||
sort: {$ref: '#/components/schemas/SmartSort'}
|
||||
limit: {type: integer, minimum: 1, maximum: 500}
|
||||
|
||||
SuggestedSmartPlaylistList:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
required: [items]
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items: {$ref: '#/components/schemas/SuggestedSmartPlaylist'}
|
||||
|
||||
SmartSort:
|
||||
type: string
|
||||
enum: [random, most_played, least_played, recently_added, title]
|
||||
|
|
|
|||
Loading…
Reference in a new issue