From 07f3a992af79cbd4f849326a6f0dcf79706ec8a5 Mon Sep 17 00:00:00 2001 From: Konstantin Portnov Date: Tue, 14 Oct 2025 21:54:17 +0200 Subject: [PATCH] Parse feed identifier --- Sources/OPDS/OPDS1Parser.swift | 2 ++ Sources/Shared/OPDS/OpdsMetadata.swift | 1 + Tests/OPDSTests/readium_opds1_1_test.swift | 1 + 3 files changed, 4 insertions(+) diff --git a/Sources/OPDS/OPDS1Parser.swift b/Sources/OPDS/OPDS1Parser.swift index 92cd83a7a..43d38125e 100644 --- a/Sources/OPDS/OPDS1Parser.swift +++ b/Sources/OPDS/OPDS1Parser.swift @@ -93,6 +93,8 @@ public class OPDS1Parser: Loggable { } let feed = Feed(title: title) + feed.metadata.identifier = root.firstChild(tag: "id")?.stringValue + if let tmpDate = root.firstChild(tag: "updated")?.stringValue, let date = tmpDate.dateFromISO8601 { diff --git a/Sources/Shared/OPDS/OpdsMetadata.swift b/Sources/Shared/OPDS/OpdsMetadata.swift index 1576eaf1f..766131357 100644 --- a/Sources/Shared/OPDS/OpdsMetadata.swift +++ b/Sources/Shared/OPDS/OpdsMetadata.swift @@ -9,6 +9,7 @@ import Foundation /// OPDS metadata properties. public class OpdsMetadata { public var title: String + public var identifier: String? public var numberOfItem: Int? public var itemsPerPage: Int? public var currentPage: Int? diff --git a/Tests/OPDSTests/readium_opds1_1_test.swift b/Tests/OPDSTests/readium_opds1_1_test.swift index a79a345e8..7eccb60f0 100644 --- a/Tests/OPDSTests/readium_opds1_1_test.swift +++ b/Tests/OPDSTests/readium_opds1_1_test.swift @@ -46,6 +46,7 @@ class readium_opds1_1_test: XCTestCase { } func testMetadata() { + XCTAssert(feed!.metadata.identifier == "urn:uuid:433a5d6a-0b8c-4933-af65-4ca4f02763eb") XCTAssert(feed!.metadata.title == "Unpopular Publications") // TODO: add more tests... }