diff --git a/README_JSON_API.md b/README_JSON_API.md index 0688526c..fb1ec68f 100644 --- a/README_JSON_API.md +++ b/README_JSON_API.md @@ -673,6 +673,7 @@ curl -X PUT "http://localhost:3689/api/queue/items/2" | GET | [/api/library/albums/{id}/tracks](#list-album-tracks) | Get list of tracks for an album | | GET | [/api/library/genres](#list-genres) | Get list of genres | | GET | [/api/library/count](#get-count-of-tracks-artists-and-albums) | Get count of tracks, artists and albums | +| GET | [/api/library/files](#list-local-directories) | Get list of directories in the local library | | GET | [/api/update](#trigger-rescan) | Trigger a library rescan | @@ -1205,7 +1206,7 @@ curl -X GET "http://localhost:3689/api/library/albums/1/tracks" ``` -### list genres +### List genres Get list of genres @@ -1377,6 +1378,105 @@ curl -X GET "http://localhost:3689/api/library/count?expression=data_kind+is+fil ``` +### List local directories + +List the local directories and the directory contents (tracks and playlists) + + +**Endpoint** + +```http +GET /api/library/files +``` + +**Query parameters** + +| Parameter | Value | +| --------------- | ----------------------------------------------------------- | +| directory | *(Optional)* A path to a directory in your local library. | + +**Response** + +| Key | Type | Value | +| --------------- | -------- | ----------------------------------------- | +| directories | array | Array of [`directory`](#directory-object) objects containing the sub directories | +| tracks | object | [`paging`](#paging-object) object containing [`track`](#track-object) objects that matches the `directory` | +| playlists | object | [`paging`](#paging-object) object containing [`playlist`](#playlist-object) objects that matches the `directory` | + + +**Example** + +```shell +curl -X GET "http://localhost:3689/api/library/files?directory=/music/srv" +``` + +```json +{ + "directories": [ + { + "path": "/music/srv/Audiobooks" + }, + { + "path": "/music/srv/Music" + }, + { + "path": "/music/srv/Playlists" + }, + { + "path": "/music/srv/Podcasts" + } + ], + "tracks": { + "items": [ + { + "id": 1, + "title": "input.pipe", + "artist": "Unknown artist", + "artist_sort": "Unknown artist", + "album": "Unknown album", + "album_sort": "Unknown album", + "album_id": "4201163758598356043", + "album_artist": "Unknown artist", + "album_artist_sort": "Unknown artist", + "album_artist_id": "4187901437947843388", + "genre": "Unknown genre", + "year": 0, + "track_number": 0, + "disc_number": 0, + "length_ms": 0, + "play_count": 0, + "skip_count": 0, + "time_added": "2018-11-24T08:41:35Z", + "seek_ms": 0, + "media_kind": "music", + "data_kind": "pipe", + "path": "/music/srv/input.pipe", + "uri": "library:track:1", + "artwork_url": "/artwork/item/1" + } + ], + "total": 1, + "offset": 0, + "limit": -1 + }, + "playlists": { + "items": [ + { + "id": 8, + "name": "radio", + "path": "/music/srv/radio.m3u", + "smart_playlist": true, + "uri": "library:playlist:8" + } + ], + "total": 1, + "offset": 0, + "limit": -1 + } +} +``` + + ### Trigger rescan Trigger a library rescan @@ -1817,6 +1917,12 @@ curl --include \ | name | string | Name of genre | +### `directory` object + +| Key | Type | Value | +| --------------- | -------- | ----------------------------------------- | +| path | string | Directory path | + ### Artwork urls @@ -1825,4 +1931,4 @@ Absolute artwork urls are pointing to external artwork images (e. g. for radio s It is possible to add the query parameters `maxwidth` and/or `maxheight` to relative artwork urls, in order to get a smaller image (forked-daapd only scales down never up). -Note that even if a relative artwork url attribute is present, it is not guaranteed to exist. \ No newline at end of file +Note that even if a relative artwork url attribute is present, it is not guaranteed to exist.