Documentation
¶
Overview ¶
Package overdrive maps OverDrive/Libby "thunder" API records (as cached by a scan) directly to libcodex BIBFRAME Work/Instance grains (see bibframe.go). It is the ingest half of the OverDrive reference provider (ARCHITECTURE §9): each cached Item exposes Identity/Work/Instance for the shared ingest.Run pipeline, so a cached collection becomes canonical feed:overdrive grains with no MARC intermediate. The live fetch is a separate concern; this reads the on-disk page cache so a build needs no API call.
Index ¶
Constants ¶
const ( // SourceBISAC is the bf:source of a BISAC subject-category code. SourceBISAC = "bisacsh" // SourceOverDrive is the bf:source of the OverDrive title id. SourceOverDrive = "overdrive" // SourceReserveID is the bf:source of the OverDrive Reserve ID -- the stable // per-edition key the availability adapter queries at view time. SourceReserveID = "overdrive-reserve" )
bf:source scheme codes for OverDrive's identifiers and classification, tagged so each is unambiguously recoverable from a grain (ARCHITECTURE §9, tasks/008). They are exported so downstream consumers -- notably the runtime availability adapter (tasks/004), which keys on the Reserve ID -- select the right node by scheme.
const ProviderName = "overdrive"
ProviderName is the OverDrive provider's registry key and default provenance feed graph (feed:overdrive).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Creator ¶
type Creator struct {
Name string `json:"name"`
Role string `json:"role"` // Author, Narrator, Illustrator, Editor, Translator
SortName string `json:"sortName"`
}
Creator is a contributor with an OverDrive role and an authorized sort form.
type Format ¶
type Format struct {
Identifiers []Identifier `json:"identifiers"`
}
Format is one delivery format; ISBNs ride on its identifiers.
type Identifier ¶
Identifier is a typed identifier (ISBN, ASIN, ...) on a format.
type Item ¶
type Item struct {
ID string `json:"id"` // OverDrive numeric title id
ReserveID string `json:"reserveId"` // OverDrive Reserve ID (Thunder availability key)
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Edition string `json:"edition"`
Series string `json:"series"`
Description string `json:"description"` // HTML fragment; plain-texted into bf:summary (tasks/126)
Type NamedID `json:"type"` // {id: ebook|audiobook, name}
Publisher *NamedID `json:"publisher"`
PublishDate string `json:"publishDate"` // ISO 8601
Creators []Creator `json:"creators"`
Languages []NamedID `json:"languages"`
Subjects []NamedID `json:"subjects"`
BISAC []BISAC `json:"bisac"`
Formats []Format `json:"formats"`
}
Item is the subset of an OverDrive media record this connector maps. Field names match the raw thunder feed (cache/pages/*.json).
func ReadCache ¶
ReadCache reads every page-*.json in dir (the OverDrive scan cache) and returns all items across the pages, in page order. A dir with no page files is an error, not an empty feed: a mistyped --cache path must not read as "the provider now carries zero titles" (tasks/103).
func (Item) BIBFRAME ¶
BIBFRAME crosswalks one OverDrive item directly to a libcodex BIBFRAME Work/Instance pair -- the OverDrive reference provider's real path (ARCHITECTURE §9), mapping the Thunder JSON feed straight to BIBFRAME with no MARC intermediate. This keeps data the MARC detour drops (notably BISAC classification) and models subjects as bf:Topic without MARC's 6xx/653 constraints. The result is serialized by BIBFRAME.Graph, so it takes the same graph shape as a record-derived BIBFRAME.
func (Item) Identity ¶
Identity returns the record's resolution keys and clustering fields for identity.Resolver to assign stable Work/Instance ids (ARCHITECTURE §4). The keys are the OverDrive title id, each ISBN, and the Reserve ID, namespaced by scheme -- ordered so the most specific (the title id) resolves first and ISBN serves as the cross-provider merge key. The clustering fields are the primary author, the main title, and the original language.
func (Item) Instance ¶
Instance returns the item's Instance-level BIBFRAME (this publication): transcribed title, edition, provision, and identifiers (ISBNs, the OverDrive title id, and the Reserve ID). Each clustered item contributes one Instance.
func (Item) Work ¶
Work returns the item's Work-level BIBFRAME (intellectual content): content class, preferred title, agents, topical subjects, languages, and BISAC classification. When items cluster into one Work, this is the shared node.
func (Item) WorkID ¶
WorkID returns a stable, IRI- and filesystem-safe id for the item, taken from the OverDrive title id (falling back to the Reserve ID). It names the grain file and the #<id>Work / #<id>Instance node IRIs. Phase 0 only: ARCHITECTURE §4's identity model replaces this with a minted, provider-independent id.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the OverDrive reference ingest provider (ARCHITECTURE §9): it reads a cached Thunder scan and yields its items as resolvable records for the shared ingest.Run pipeline. It holds only build-time config; the live availability half is a separate runtime adapter (tasks/004).
func (Provider) Records ¶
Records reads the OverDrive scan cache and returns its items as ingest records, in page order. Each Item already exposes Identity/Work/Instance, so it is an ingest.Record with no adaptation. ctx is accepted for the Provider contract; the cache read is local and does not observe cancellation.