mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 22:23:17 -05:00
[jsonapi] Add boolean field "random" to playlist
The new field "random" is true for smart playlists with an order by clause "random", otherwise it is false. This allows clients to handle randomly generated playlists differently from static playlists.
This commit is contained in:
parent
dd811e6c70
commit
20a2c96b2a
@ -338,6 +338,7 @@ playlist_to_json(struct db_playlist_info *dbpli)
|
||||
json_object *item;
|
||||
char uri[100];
|
||||
int intval;
|
||||
bool boolval;
|
||||
int ret;
|
||||
|
||||
item = json_object_new_object();
|
||||
@ -351,6 +352,10 @@ playlist_to_json(struct db_playlist_info *dbpli)
|
||||
{
|
||||
safe_json_add_string(item, "type", db_pl_type_label(intval));
|
||||
json_object_object_add(item, "smart_playlist", json_object_new_boolean(intval == PL_SMART));
|
||||
|
||||
boolval = dbpli->query_order && strcasestr(dbpli->query_order, "random");
|
||||
json_object_object_add(item, "random", json_object_new_boolean(boolval));
|
||||
|
||||
json_object_object_add(item, "folder", json_object_new_boolean(intval == PL_FOLDER));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user