Library ajax request is huge if audiobooks contains many files #144

Closed
opened 2026-04-24 22:59:27 +02:00 by adam · 4 comments
Owner

Originally created by @mx03 on GitHub (Dec 22, 2021).

My library currently contains 168 books and the size of the request is 44 MB (most books are separate tracks, total 21444 files).
I have another library with 1071 books and one file per book the request is only 2.1 MB.
Route: ( /api/libraries/XXX/books/all?sort=book.authorFL&desc=0&limit=250&page=0)

The overview list fetch this data: audioFiles, chapters, otherFiles, tracks , but most actions like editing the book, view the details already have a specific ajax request for the single book.

Best way to reduce the request size for the list would be remove these fields and fetch them only if needed.

Originally created by @mx03 on GitHub (Dec 22, 2021). My library currently contains 168 books and the size of the request is 44 MB (most books are separate tracks, total 21444 files). I have another library with 1071 books and one file per book the request is only 2.1 MB. Route: ( /api/libraries/_XXX_/books/all?sort=book.authorFL&desc=0&limit=250&page=0) The overview list fetch this data: **audioFiles**, **chapters**, **otherFiles**, **tracks** , but most actions like editing the book, view the details already have a specific ajax request for the single book. Best way to reduce the request size for the list would be remove these fields and fetch them only if needed.
adam closed this issue 2026-04-24 22:59:27 +02:00
Author
Owner

@advplyr commented on GitHub (Dec 25, 2021):

I updated the API to use the minified audiobook object for the bookshelf and to limit to 100 books per fetch.

For reference, the minified object is here https://github.com/advplyr/audiobookshelf/blob/master/server/objects/Audiobook.js#L197

This is v1.6.47

@advplyr commented on GitHub (Dec 25, 2021): I updated the API to use the minified audiobook object for the bookshelf and to limit to 100 books per fetch. For reference, the minified object is here https://github.com/advplyr/audiobookshelf/blob/master/server/objects/Audiobook.js#L197 This is `v1.6.47`
Author
Owner

@mx03 commented on GitHub (Dec 25, 2021):

Thanks, now the request is only 184 kB from (44 MB) and on chrome on android the content is much more smoother and faster.

But this this release a new bug appeared, the chapters dont appear while streaming.
I think if you press play it must fetch the specific full audiobook object ( /api/books/ab_73dd3l3xegvbsbj9gj ).

Before release (chapter marks on bar and chapterlist):
image

After release:
image

@mx03 commented on GitHub (Dec 25, 2021): Thanks, now the request is only 184 kB from (44 MB) and on chrome on android the content is much more smoother and faster. But this this release a new bug appeared, the chapters dont appear while streaming. I think if you press play it must fetch the specific full audiobook object ( /api/books/ab_73dd3l3xegvbsbj9gj ). Before release (chapter marks on bar and chapterlist): ![image](https://user-images.githubusercontent.com/1390929/147385503-96794e69-d8a3-4bba-97ba-0e7d2ba2b649.png) After release: ![image](https://user-images.githubusercontent.com/1390929/147385509-797b9be7-f3f1-4ba2-a56d-5a152f344753.png)
Author
Owner

@advplyr commented on GitHub (Dec 25, 2021):

Good catch, I just pushed a patch over the current version that fixes this.
Basically once the stream opens the server sends back the full audiobook object.

@advplyr commented on GitHub (Dec 25, 2021): Good catch, I just pushed a patch over the current version that fixes this. Basically once the stream opens the server sends back the full audiobook object.
Author
Owner

@mx03 commented on GitHub (Dec 30, 2021):

I think that's done and the fix for stream works.

@mx03 commented on GitHub (Dec 30, 2021): I think that's done and the fix for stream works.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#144