[PR #728] [CLOSED] [DRAFT] Inject chapter scanner dependency in to Book #3401

Closed
opened 2026-04-25 00:15:30 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/728
Author: @jmt-gh
Created: 6/14/2022
Status: Closed

Base: masterHead: refactor_chapter_scanners


📝 Commits (1)

  • 7eab018 Inject chapter scanner dependency in to Book

📊 Changes

5 files changed (+233 additions, -204 deletions)

View changed files

📝 server/objects/mediaTypes/Book.js (+4 -56)
📝 server/scanner/Scanner.js (+9 -0)
server/utils/parsers/chapters/parseFromMediaFile.js (+63 -0)
server/utils/parsers/chapters/parseOverdriveMediaMarkers.js (+157 -0)
server/utils/parsers/parseOverdriveMediaMarkers.js (+0 -148)

📄 Description

This commit implements depdency injection for the chapter scanner to be used in Book. In a previous commit when the ovedrive media marker support was added, Book was making it's own decisions about which scanner to use, but that opened it up to needing to know a lot about serverSettings which felt wrong.

Instead, now we will set the chapterScanner property on Book to either OverdriveMediaMarkers or parsing it directly from MediaFile.

This required converting both parses to classe, of which I decided to make them static utility classes, as instanced classes wouldn't provide much value here.

Todo / Open Questions / still being investigated

  • Q: Is Scanner the right place to handle the logic of figuring out which parser to pass in? If not, where?
  • Todo: support the rest of the scan types (right now it only supports single book re-scan)
  • Todo: Clean up the rest of the old OverdriveMediaMarker preferences code that was being passed around
  • Todo: Add some class level documentation to both parsers

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/728 **Author:** [@jmt-gh](https://github.com/jmt-gh) **Created:** 6/14/2022 **Status:** ❌ Closed **Base:** `master` ← **Head:** `refactor_chapter_scanners` --- ### 📝 Commits (1) - [`7eab018`](https://github.com/advplyr/audiobookshelf/commit/7eab018b43e7cf311e51a8b6a12c12bfbb219418) Inject chapter scanner dependency in to Book ### 📊 Changes **5 files changed** (+233 additions, -204 deletions) <details> <summary>View changed files</summary> 📝 `server/objects/mediaTypes/Book.js` (+4 -56) 📝 `server/scanner/Scanner.js` (+9 -0) ➕ `server/utils/parsers/chapters/parseFromMediaFile.js` (+63 -0) ➕ `server/utils/parsers/chapters/parseOverdriveMediaMarkers.js` (+157 -0) ➖ `server/utils/parsers/parseOverdriveMediaMarkers.js` (+0 -148) </details> ### 📄 Description This commit implements depdency injection for the chapter scanner to be used in Book. In a previous commit when the ovedrive media marker support was added, Book was making it's own decisions about which scanner to use, but that opened it up to needing to know a lot about serverSettings which felt wrong. Instead, now we will set the chapterScanner property on Book to either OverdriveMediaMarkers or parsing it directly from MediaFile. This required converting both parses to classe, of which I decided to make them static utility classes, as instanced classes wouldn't provide much value here. **Todo / Open Questions / still being investigated** - **Q**: Is Scanner the right place to handle the logic of figuring out which parser to pass in? If not, where? - **Todo**: support the rest of the scan types (right now it only supports single book re-scan) - **Todo**: Clean up the rest of the old OverdriveMediaMarker preferences code that was being passed around - **Todo**: Add some class level documentation to both parsers --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:15:30 +02:00
adam closed this issue 2026-04-25 00:15:30 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3401