[PR #4113] [MERGED] Update opf parser to support refines meta elements #4168

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

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4113
Author: @advplyr
Created: 3/13/2025
Status: Merged
Merged: 3/14/2025
Merged by: @advplyr

Base: masterHead: parsing-opf-v3


📝 Commits (2)

  • de22177 Update opf parser to support refines meta elements
  • 804dafd Add test for parseOpfMetadata OPF v3 author

📊 Changes

3 files changed (+94 additions, -61 deletions)

View changed files

📝 server/scanner/OpfFileScanner.js (+9 -7)
📝 server/utils/parsers/parseOpfMetadata.js (+25 -4)
📝 test/server/utils/parsers/parseOpfMetadata.test.js (+60 -50)

📄 Description

Brief summary

Parse OPF v3
See https://github.com/advplyr/audiobookshelf/discussions/4109

Which issue is fixed?

None

In-depth Description

In OPF v3 meta elements can have a refines attribute that is an ID of another element it is describing.

In this example the role of the dc:creator element is in the refines meta element.

<package version="3.0" unique-identifier="uuid_id" prefix="rendition: http://www.idpf.org/vocab/rendition/#" xmlns="http://www.idpf.org/2007/opf">
  <metadata>
    <dc:creator id="create1">Nevil Shute</dc:creator>
    <meta refines="#create1" property="role" scheme="marc:relators">aut</meta>
    <meta refines="#create1" property="file-as">Shute, Nevil</meta>
  </metadata>
</package>

How have you tested this?

Added test case


🔄 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/4113 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 3/13/2025 **Status:** ✅ Merged **Merged:** 3/14/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `parsing-opf-v3` --- ### 📝 Commits (2) - [`de22177`](https://github.com/advplyr/audiobookshelf/commit/de22177dbf7413d8cb128e7c1c0dea941583afbc) Update opf parser to support refines meta elements - [`804dafd`](https://github.com/advplyr/audiobookshelf/commit/804dafdfcb8acaa635de1d4949d0eefd3727e286) Add test for parseOpfMetadata OPF v3 author ### 📊 Changes **3 files changed** (+94 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `server/scanner/OpfFileScanner.js` (+9 -7) 📝 `server/utils/parsers/parseOpfMetadata.js` (+25 -4) 📝 `test/server/utils/parsers/parseOpfMetadata.test.js` (+60 -50) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Parse OPF v3 See https://github.com/advplyr/audiobookshelf/discussions/4109 ## Which issue is fixed? None ## In-depth Description In OPF v3 [meta elements](https://www.w3.org/TR/epub-33/#sec-meta-elem) can have a `refines` attribute that is an ID of another element it is describing. In this example the role of the `dc:creator` element is in the refines meta element. ```xml <package version="3.0" unique-identifier="uuid_id" prefix="rendition: http://www.idpf.org/vocab/rendition/#" xmlns="http://www.idpf.org/2007/opf"> <metadata> <dc:creator id="create1">Nevil Shute</dc:creator> <meta refines="#create1" property="role" scheme="marc:relators">aut</meta> <meta refines="#create1" property="file-as">Shute, Nevil</meta> </metadata> </package> ``` ## How have you tested this? Added test case --- <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:18:38 +02:00
adam closed this issue 2026-04-25 00:18:38 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4168