-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathaudioserve-api-v1.yaml
1223 lines (1187 loc) · 41.9 KB
/
audioserve-api-v1.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.1
info:
title: audioserve API
description: REST API for audioserve
version: 1.3.1
servers:
- url: https://audioserve.zderadicka.eu
description: Public demo server
- url: http://localhost:3000
description: Your local test server
tags:
- name: "Authentication"
description: Authentication endpoint
- name: "Collections"
description: Audio collections browsing and playing
- name: Positions
description: Playback position
paths:
# authentication endpoint
/authenticate:
post:
tags:
- "Authentication"
description: |-
Authentication to server via salted shared secret
Salted shared secret is calculated as:
* shared secret is encoded as UTF-8 bytes
* client generates 32 random bytes
* secret is concatenated with random bytes (secret+random_bytes)
* these bytes are hashed with SHA-256
* random bytes are encoded with base64 encoding
* hash is encoded with base64 encoding
* resulting secret is string concation of three strings : "encoded random" + "|" + "encoded hash"
security: [] # no security as this is an authentication endpoint
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/SharedSecret"
application/json:
schema:
$ref: "#/components/schemas/SharedSecret"
examples:
sample:
description: Salted shared secred `mypass`
value:
secret: "w8lTEszPU3idF9sEawmRR3Ps3IVdMEnnaFZj5DV5tqY=|6+iBRdZRz/o6fvwHiEuS2sgDZS6YCw7wNHVX59YCh50="
responses:
"200":
description: Successfull authentication, response contains authentication token
content:
text/plain:
schema:
type: string
maxLength: 250
pattern: "^[a-zA-Z0-9+/]+=*$"
examples:
"0":
value: >-
E114Vfv45RowIr0bFMNiJFRsPweZfINmhfTUFFy1Er8AAAAAY2drA/2XKsZSMnsc3a+yRIKjQIFaAEOcROCaTYR1jUjo6ow1
"401":
description: Failed authentication
# collections end point
/collections/:
get:
tags:
- "Collections"
description: |-
Returns list of available collections (collection is a directory provided as parameter to audioserve server).
It should be first call to server, after client authenticates itself.
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionsInfo"
example:
{
"version": "0.16.3",
commit:"a6e9a3f",
"folder_download": true,
"shared_positions": true,
"count": 1,
"names": ["audiobooks"],
}
"401":
$ref: "#/components/responses/Unauthorized"
# transcodings endpoint
/transcodings/:
get:
tags:
- "Collections"
description: |-
Gets current transcoding settings on the server.
Server has 3 transcodings presets: `high`, `medium`, `low` (or no transcoding), between which client can choose, when
streaming audofile.
If `max_transcodings` is reached server returns `503 Service Unavailable` - it's client responsibility to retry later.
Normally should be called after `collections` call, unless client is not interested in transcoding capabilities at all.
responses:
"200":
description: Success - returns transcodings settings
content:
application/json:
schema:
$ref: "#/components/schemas/TranscodingsInfo"
example:
{
"max_transcodings": 24,
"low": { "bitrate": 32, "name": "opus-in-ogg" },
"medium": { "bitrate": 48, "name": "opus-in-ogg" },
"high": { "bitrate": 64, "name": "opus-in-ogg" },
}
"401":
$ref: "#/components/responses/Unauthorized"
# Cover endpoint
/{col_id}/cover/{path}:
get:
tags:
- "Collections"
description: |
Returns cover image for indicated `path` (if exists)
Path for cover should be taken from object returend by `folder` endpoint.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
responses:
"200":
description: Success - returns image binary - jpeg or png
content:
"image/*":
schema:
type: string
format: binary
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
# Icon endpoint
/{col_id}/icon/{path}:
get:
tags:
- "Collections"
description: |
Returns folder icon (icon is scaled down normalize cover image)
for indicated path `path` (if cover exists).
Path is folder path.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
responses:
"200":
description: Success - returns image binary - png
content:
"image/png":
schema:
type: string
format: binary
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
/{col_id}/desc/{path}:
get:
tags:
- "Collections"
description: |
Returns description file (if exists)
Path for description file should be taken from object returend by `folder` endpoint.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
responses:
"200":
description: Success - returns description text - plain, html or markdown
content:
"text/*":
schema:
type: string
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
/{col_id}/folder/:
get:
tags:
- "Collections"
description: |
List contents of root folder of the collection.
See `/{col_id}/folder/{path}` for more detailed description.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Ordering"
- $ref: "#/components/parameters/Group"
responses:
"200":
description: Success - returns JSON object describing audio folder
content:
application/json:
schema:
$ref: "#/components/schemas/AudioFolder"
example:
{
"is_file": false,
"is_collapsed": false,
"modified": 1613948393506,
"total_time": 0,
"files": [],
"subfolders":
[
{
"name": "Austene Jane",
"modified": 1613941742570,
"path": "Austene Jane",
"is_file": false,
"finished": false,
},
{
"name": "Chesterton Gilbert Keith",
"modified": 1613824355322,
"path": "Chesterton Gilbert Keith",
"is_file": false,
"finished": false,
},
{
"name": "Doyle Arthur Conan",
"modified": 1613825015324,
"path": "Doyle Arthur Conan",
"is_file": false,
"finished": false,
},
{
"name": "Wells H G",
"modified": 1613902871789,
"path": "Wells H G",
"is_file": false,
"finished": false,
},
],
"cover": null,
"description":
{ "path": "welcome.md", "mime": "text/markdown" },
"tags": null,
}
"401":
$ref: "#/components/responses/Unauthorized"
/{col_id}/folder/{path}:
get:
tags:
- "Collections"
description: |
Lists available subfolders or audio files in the folder.
Response contains arrays `files` and/or `subfolders` (each can be null or empty array).
Subfolders can be listed using this API endpoint, `files` contains playable files -
their `path` should be used with `audio` endpoint for streaming file content.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
- $ref: "#/components/parameters/Ordering"
- $ref: "#/components/parameters/Group"
responses:
"200":
description: Success - returns JSON object describing audio folder
content:
application/json:
schema:
$ref: "#/components/schemas/AudioFolder"
examples:
"Author folder":
value:
{
"is_file": false,
"is_collapsed": false,
"modified": 1613902871789,
"total_time": 0,
"files": [],
"subfolders":
[
{
"name": "Invisible Man",
"modified": 1613902936821,
"path": "Wells H G/Invisible Man",
"is_file": false,
"finished": false,
},
],
"cover":
{
"path": "Wells H G/H.G._Wells_by_Beresford.jpg",
"mime": "image/jpeg",
},
"description":
{ "path": "Wells H G/info.txt", "mime": "text/plain" },
"tags": null,
}
"Audiobook folder":
value:
{
"is_file": false,
"modified": 1613902936821,
"total_time": 18079,
"files":
[
{
"name": "invisibleman_01_wells_64kb.mp3",
"path": "Wells H G/Invisible Man/invisibleman_01_wells_64kb.mp3",
"meta":
{
"duration": 1362,
"bitrate": 64,
"tags": { "title": "01 - Chapters I and II" },
},
"mime": "audio/mpeg",
"section": null,
},
{
"name": "invisibleman_02_wells_64kb.mp3",
"path": "Wells H G/Invisible Man/invisibleman_02_wells_64kb.mp3",
"meta":
{
"duration": 1482,
"bitrate": 64,
"tags": { "title": "02 - Chapters III and IV" },
},
"mime": "audio/mpeg",
"section": null,
},
],
"subfolders": [],
"cover":
{
"path": "Wells H G/Invisible Man/220px-Wells_-_The_Invisible_Man_-_Pearson_cover_1897.jpg",
"mime": "image/jpeg",
},
"description":
{
"path": "Wells H G/Invisible Man/info.html",
"mime": "text/html",
},
"position":
{
"path": "Wells H G/Invisible Man/invisibleman_09_wells_64kb.mp3",
"timestamp": 1635427462226,
"position": 1324.175,
},
"tags":
{
"genre": "speech",
"artist": "H. G. Wells",
"album": "The Invisible Man",
},
}
"m4b folder":
value:
{
"is_file": true,
"modified": 1615456636344,
"total_time": 63547,
"files":
[
{
"name": "000 - Chapter_1",
"path": "Stoker Bram/Dracula/Dracula.m4b$$000 - Chapter_1$$0-1020288$$.m4b",
"meta":
{ "duration": 1020, "bitrate": 54, "tags": null },
"mime": "audio/m4b",
"section": { "start": 0, "duration": 1020288 },
},
{
"name": "001 - Chapter_2",
"path": "Stoker Bram/Dracula/Dracula.m4b$$001 - Chapter_2$$1020288-2029004$$.m4b",
"meta":
{ "duration": 1008, "bitrate": 54, "tags": null },
"mime": "audio/m4b",
"section":
{ "start": 1020288, "duration": 1008716 },
},
],
"subfolders": [],
"cover":
{
"path": "Stoker Bram/Dracula/800px-Dracula-First-Edition-1897_(cropped).jpg",
"mime": "image/jpeg",
},
"description":
{
"path": "Stoker Bram/Dracula/info.txt",
"mime": "text/plain",
},
"position":
{
"path": "Stoker Bram/Dracula/Dracula.m4b$$004 - Chapter_5$$3452020-4080784$$.m4b",
"timestamp": 1635963253408,
"position": 111.82,
},
"tags":
{
"title": "Dracula",
"album": "Dracula",
"genre": "Audio Book",
"date": "2014",
"artist": "Bram Stoker",
},
}
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
/{col_id}/audio/{path}:
get:
tags:
- "Collections"
description: |
Streams (possibly transcoded) audio file
File is sent either directly (in this case [http bytes range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests)
is supported - but only one range per response)
or transcoded (in this case response content is [chunck encoded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding)
and its length is not known in advance). Transcoding is triggered by query string paramater `trans`.
Typical usecase is that client loads transcoding parameters from `transcodings` endpoint
and then for each audio file decides if transcoding is required or not based on `mime` and `bitrate` values
available in folder listing.
Transcoded files can be also seek for playback start- query string parameter `seek` can contain start of stream in seconds (related to
normal begining of file). Plain, not transcoded files cannot be seeked in this way (they support byte ranges, which are
usually enough for a player to seek efficiently). So `seek` can be used only with `trans`.
Number of transcoding processing is limited on server, as it is lengthy and resources demanding (mainly CPU)
process. If maximum number of transcodings is already used, this endpoint will return HTTP response 503 Service Unavailable.
It's client responsibility to handle such cases.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
example: Austene Jane/Pride And Prejudice/prideandprejudice_22_austen_64kb.mp3
- name: seek
in: query
description: |-
Stars playback as <seek> seconds from beginning of file.
Beware overusing this parameter, as it can cause quite ineffective usage
of bandwidth and transcoding (which each seek like this part of file from
seek position is send again)
schema:
type: number
format: float
example: 223.299
- name: trans
in: query
description: |-
Required transcoding of the file **l**ow, **m**edium or **h**igh
as described by `/transcodings` endpoint response
If omitted or set to **0** no transcoding is done
schema:
type: string
enum: [l, m, h, "0"]
example: m
- name: range
in: header
description: |-
Optionally client can request range of bytes from file, will only work if
file is not actually transcoded.
Range is standard HTTP header as per [RFC 7233](https://datatracker.ietf.org/doc/html/rfc7233)
schema:
type: string
example: bytes=14286848-
responses:
"200":
description: Success - audio is sent in response body
content:
"audio:*":
example: N/A
schema:
type: string
format: binary
description: |-
Audio stream in original or transcoded version.
If size of stream is not know (transcoded stream) response body is chunked
headers:
x-transcode:
description: If file is transcoded contains information about transcoding
schema:
type: string
example: codec=opus-in-ogg; bitrate=48
"206":
description: "Success - part of audio file, if Range: bytes were requested"
content:
"audio/*":
example: N/A
schema:
type: string
format: binary
headers:
content-range:
description: Bytes range returned in response to request header `Range`
schema:
type: string
example: bytes 14286848-14296697/14296698
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"503":
description: Number of transcodings over limit
/{col_id}/search:
get:
tags:
- "Collections"
description: |
Search collection - search for terms with collection paths (path only not metadata tags).
Search is looking only for folders (including virtual folders for chaptered files).
Search term is split to words and each word is searched in full path (relative collection root -
the path you see in folder listing).
First path that includes all words in added to results (and it's subfolders are not searched further).
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Ordering"
- $ref: "#/components/parameters/Group"
- name: q
in: query
required: true
description: |
Search terms (separated by space). Looks for all terms on folder path.
schema:
type: string
responses:
"200":
description: Success - all found folders within this collection
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResult"
example:
{
"files": [],
"subfolders":
[
{
"name": "Around The World in Eighty Days",
"modified": 1613824559416,
"path": "Verne Jules/Around The World in Eighty Days",
"is_file": false,
"finished": false,
},
{
"name": "Austene Jane",
"modified": 1613941742570,
"path": "Austene Jane",
"is_file": false,
"finished": false,
},
],
}
"401":
$ref: "#/components/responses/Unauthorized"
/{col_id}/recent:
get:
tags:
- "Collections"
description: |
Lists top 100 most recent folders in the collection (based on folder modification time).
Sorted by folder modification time descendently - e.g most recent is first.
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Group"
responses:
"200":
description: Success - most recent folders
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResult"
example:
{
"files": [],
"subfolders":
[
{
"name": "Around The World in Eighty Days",
"modified": 1613824559416,
"path": "Verne Jules/Around The World in Eighty Days",
"is_file": false,
"finished": false,
},
{
"name": "Austene Jane",
"modified": 1613941742570,
"path": "Austene Jane",
"is_file": false,
"finished": false,
},
],
}
"401":
$ref: "#/components/responses/Unauthorized"
/{col_id}/download/{path}:
get:
tags:
- "Collections"
description: |
Downloads content of folder as an archive (zip or tar)
Downloads all files (audio files, cover, description) from this folder as an archive (zip or tar).
Default format of the archive is zip, tar archive is also supported - format can be chosen by `fmt` query parameter
Also if you want to change default format by compiling audioserve with `folder-download-default-tar` feature.
This endpoint can be disabled, if audioserve is compiled without default feature `folder-download`
or with command line argument `--disable-folder-download` .
parameters:
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
- name: fmt
in: query
description: |-
Archive format - zip(default) or tar
schema:
type: string
enum: [zip, tar]
example: zip
responses:
"200":
description: Success
content:
application/zip:
schema:
type: string
format: binary
description: zip archive
application/x-tar:
schema:
type: string
format: binary
description: tar archive
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
/positions/{group}:
get:
tags:
- Positions
description: Get recent positions for the group
parameters:
- $ref: "#/components/parameters/GroupInPath"
- $ref: "#/components/parameters/Finished"
- $ref: "#/components/parameters/Unfinished"
- $ref: "#/components/parameters/From"
- $ref: "#/components/parameters/To"
responses:
"200":
description: |-
List of recent positions for given group.
Ordered from most recent.
Limited to 1000 items max.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Position"
maxItems: 1000
example:
[
{
"timestamp": 1636726423847,
"collection": 0,
"folder": "Wells H G/Invisible Man",
"file": "invisibleman_09_wells_64kb.mp3",
"folder_finished": false,
"position": 1395.955,
},
{
"timestamp": 1636484689121,
"collection": 0,
"folder": "Stevenson Robert Louis/Treasure Island",
"file": "treasureisland_04_stevenson_64kb.mp3",
"folder_finished": false,
"position": 38.555,
},
{
"timestamp": 1636484567281,
"collection": 0,
"folder": "Stoker Bram/Dracula",
"file": "Dracula.m4b$$004 - Chapter_5$$3452020-4080784$$.m4b",
"folder_finished": false,
"position": 195.34,
},
]
"401":
$ref: "#/components/responses/Unauthorized"
post:
tags:
- Positions
parameters:
- $ref: "#/components/parameters/GroupInPath"
description: Updates recent position for given group
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Position"
responses:
"201":
description: Position updated
"401":
$ref: "#/components/responses/Unauthorized"
"400":
$ref: "#/components/responses/InvalidRequest"
"422":
description: Post ignored - either there no such folder/file or there is newer position there
content:
text/plain:
schema:
type: string
example: Ignored
/positions/{group}/last:
get:
tags:
- Positions
parameters:
- $ref: "#/components/parameters/GroupInPath"
description: Last recent position for this group
responses:
"200":
description: |-
Last recent position or null
content:
application/json:
schema:
$ref: "#/components/schemas/Position"
examples:
Position for group exists:
value:
{
"timestamp": 1636793358494,
"collection": 0,
"folder": "Wells H G/Invisible Man",
"file": "invisibleman_09_wells_64kb.mp3",
"folder_finished": false,
"position": 130,
}
No last position:
value: null
"401":
$ref: "#/components/responses/Unauthorized"
/positions/{group}/{col_id}/{path}:
get:
tags:
- Positions
parameters:
- $ref: "#/components/parameters/GroupInPath"
- $ref: "#/components/parameters/CollectionId"
- $ref: "#/components/parameters/Path"
- $ref: "#/components/parameters/Finished"
- $ref: "#/components/parameters/Unfinished"
- $ref: "#/components/parameters/From"
- $ref: "#/components/parameters/To"
- name: rec
description: |-
Recursively look for all subdirectories
in: query
required: false
schema:
type: boolean
description: |-
Last recent position for given folder path (`path` can be empty to for root of collection,
but in this case / must be present after `col_id`` ).
If `rec` query parameter is given recursive search is done for this folder and all subfolders and
list of postions is returned.
responses:
"200":
description: |-
Last recent position or null
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Position"
- type: array
items:
$ref: "#/components/schemas/Position"
maxItems: 1000
examples:
Without rec parameter:
description: Returns single position or null
value:
{
"timestamp": 1636793358494,
"collection": 0,
"folder": "Wells H G/Invisible Man",
"file": "invisibleman_09_wells_64kb.mp3",
"folder_finished": false,
"position": 130,
}
With rec parameter:
description: Returns list of positions
value:
[
{
"timestamp": 1636793358494,
"collection": 0,
"folder": "Wells H G/Invisible Man",
"file": "invisibleman_09_wells_64kb.mp3",
"folder_finished": false,
"position": 130,
},
]
"401":
$ref: "#/components/responses/Unauthorized"
"400":
$ref: "#/components/responses/InvalidRequest"
components:
schemas:
Transcoding:
type: object
required:
- "name"
- "bitrate"
properties:
name:
type: string
description: Name of transcoding in form of audio_codec-in-container, for instance opus-in-ogg
bitrate:
type: integer
description: Average bitrate of the transcoding in kbps
minimum: 0
TypedFile:
type: object
nullable: true
required:
- "path"
- "mime"
properties:
path:
type: string
description: path to the file with collection
maxLength: 512
mime:
type: string
description: mime type of the file
Subfolder:
type: object
required:
- "name"
- "path"
properties:
name:
type: string
path:
type: string
is_file:
type: boolean
description: Is virtual folder - e.g. representing big chapterized file (.m4b etc.)
modified:
type: number
description: last modification timestamp (unix time in miliseconds)
finished:
type: boolean
description: was folder listened to the end (by given group, valid only if group parameter was provided)
AudioFolder:
type: object
properties:
is_file:
type: boolean
description: Is virtual folder - e.g. representing big chapterized file (.m4b etc.)
is_collapsed:
type: boolean
description: Folder contains files from CD subfolders, structure is collapsed
modified:
type: number
description: last modification timestamp (unix time in miliseconds)
total_time:
type: integer
description: Total playback time of the audiofolder in seconds
subfolders:
type: array
items:
$ref: "#/components/schemas/Subfolder"
files:
type: array
items:
$ref: "#/components/schemas/AudioFile"
cover:
description: Cover image
$ref: "#/components/schemas/TypedFile"
description:
$ref: "#/components/schemas/TypedFile"
tags:
type: object
nullable: true
description: Metadata tags for this folders - map of name to value
position:
$ref: "#/components/schemas/PositionShort"
AudioFile:
type: object
required:
- "name"
- "path"
- "mime"
properties:
"name":
type: string
example: "000 - Chapter_1"
"path":
type: string
example: "Stoker Bram/Dracula/Dracula.m4b$$000 - Chapter_1$$0-1020288$$.m4b"
"meta":
type: object
nullable: true
properties:
"duration":
type: integer
description: Duration of audio file in seconds
example: 1020,
"bitrate":
type: integer
description: Encoding bitrate of file - original, before transcoding
example: 54,
"tags":
type: object
description: Metadata tags as map of name to value
nullable: true
"mime":
type: string
description: Mime type of audio file (before transcoding)
example: "audio/m4b"
"section":
type: object
nullable: true
description: |
For chapter chunk out from big chaptered file (like .m4b)
this is start and duration (in milliseconds) of chapter with the that file
properties:
"start":
type: integer
description: Start of chapter in ms
example: 0
"duration":
type: integer
description: Duration of chapter in ms
example: 1020288
SearchResult:
type: object
properties:
files:
type: array
items:
$ref: "#/components/schemas/AudioFile"
description: Not used now, only subfolders are searched
subfolders:
type: array
items:
$ref: "#/components/schemas/Subfolder"
PositionShort:
type: object
description: |-
Last shared playback position within a folder.
Only available if group parameter was used and there are some audiofiles in the folder.
nullable: true
properties:
timestamp:
type: integer
format: int64
description: |-
Position timestamp - unix time in ms
Timestamp is generated on server, so if you post new position
it is used to check, if there is not newer position,
but actual value then is assigned by server
path:
type: string
description: Audio file (or chapter)
position:
type: number
format: float