metadata-extractionlisted
Install: claude install-skill brege/dewey-decimal-skill
# Metadata Extraction
Extract bibliographic metadata from ebook files.
## Priority Order
1. EPUB OPF metadata (most authoritative)
2. PDF document properties
3. Filename parsing (least reliable)
4. User input (for disambiguation only)
## EPUB Extraction
### Step 1: Find OPF Path
```bash
unzip -p "$file" META-INF/container.xml | grep -oP 'full-path="\K[^"]*'
```
Returns path like `OEBPS/content.opf` or `content.opf`.
### Step 2: Extract Metadata
```bash
unzip -p "$file" "$opf_path" | grep -E '<dc:(creator|title|date|contributor)'
```
### Fields
| Tag | Content |
|-----|---------|
| `<dc:creator>` | Author name(s) |
| `<dc:title>` | Book title |
| `<dc:date>` | Publication date (extract YYYY) |
| `<dc:contributor opf:role="trn">` | Translator |
| `<dc:contributor opf:role="edt">` | Editor |
## PDF Extraction
```bash
pdfinfo "$file" 2>/dev/null | grep -E '^(Title|Author|CreationDate|ModDate):'
```
Extract:
- Title field
- Author field
- CreationDate year (format: D:YYYYMMDDhhmmss)
## Filename Parsing
Parse for hints when metadata insufficient:
- Author: Often at start, before dash or title
- Title: Main text
- Year: Four digits in parentheses or at end
Example: `Charles.Bukowski.-.Love.Is.A.Dog.From.Hell.2007.RETAIL.EPUB.eBook-CTO.epub`
- Author: Charles Bukowski
- Title: Love Is A Dog From Hell
- Year: 2007
## Year Rules
Use publication year of THIS edition, not original work.
- Aristotle's Nicomachean Ethics (ancient) with Irwin translation (2019): use 2019