A library to help create, maintain and index a digital library of electronic book, youtube transcripts and summaries of them
Project description
Resource Librarian
A Python library for creating, maintaining, and indexing a personal library of digital resources. Organize your books and YouTube video transcripts in a way that's perfect for processing with modern AI systems.
What is Resource Librarian?
Resource Librarian helps you build a filesystem-based knowledge library from:
- Books (PDF, EPUB, Markdown)
- YouTube videos (transcripts and metadata)
No database required - everything is organized in plain files with YAML metadata and Markdown indices.
Key Features
๐ Book Management
- Supports PDF, EPUB, and Markdown formats
- Auto-extracts metadata (title, author, ISBN)
- Automatically splits EPUB into chapters
- Preserves all original formats
- Organizes by author with normalized naming
๐ฅ YouTube Video Management
- Downloads transcripts automatically
- Captures video metadata (title, channel, publish date, tags)
- Organizes by channel
- Resumable batch processing for large collections
๐๏ธ Library Organization
- Filesystem-first - All content stored as files, no database
- YAML manifests - Structured metadata for each resource
- Searchable catalog - YAML-based catalog for quick lookups
- Generated indices - Beautiful Markdown index pages for navigation
- Root README with library statistics and recent additions
- Channel-level indices for video collections
- Videos by title index for alphabetical browsing
- Category indices for topic-based navigation
- Auto-regenerated when resources are added
๐ Browse Your Library
- List all books - Filter by author, category, or tags
- View available formats - PDF, EPUB, Markdown, chapters
- Retrieve content - Full books or specific chapters
- Access summaries - View existing summaries for any resource
- Navigate with indices - Library-wide and per-book navigation
How It Works
Resource Librarian follows a simple workflow:
flowchart LR
Start([User]) --> Init[rl init<br/>Create Library]
Init --> Add{Add Resources}
Add -->|Books| AddBook[rl book add]
Add -->|Videos| AddVideo[rl video add]
AddBook --> BookParse[Parse & Extract<br/>Metadata]
BookParse --> BookStore[Organize in<br/>Library]
AddVideo --> VideoFetch[Fetch Transcript<br/>& Metadata]
VideoFetch --> VideoStore[Organize in<br/>Library]
BookStore --> Browse{Browse & Use}
VideoStore --> Browse
Browse -->|List| List[rl book/video list]
Browse -->|Get Content| Get[rl book/video get]
Browse -->|View Index| Index[Read index.md files]
Key Steps:
- Initialize - Create library structure with
rl init - Add Resources - Import books (PDF/EPUB) or YouTube videos
- Auto-Organization - Files are parsed, organized by author/channel, with metadata extracted
- Browse & Access - List, search, and retrieve content via CLI or filesystem
Installation
Prerequisites
- Python 3.11 or higher
- Git
Install from Source
# Clone the repository
git clone git@github.com:kennyrnwilson/resource-librarian.git
cd resource-librarian
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\Activate.ps1
# Install the package
pip install -e ".[dev]"
Quick Start
1. Initialize a Library
Create a new resource library:
rl init /path/to/my-library
This creates:
my-library/
โโโ README.md # Root library index with stats
โโโ catalog.yaml # Library catalog (YAML format)
โโโ _index/ # Library-wide navigation
โโโ books/
โ โโโ _index/ # Book indices
โ โโโ authors.md # Books grouped by author
โ โโโ titles.md # Books alphabetically
โโโ videos/
โ โโโ _index/ # Video indices
โ โโโ channels.md # Videos grouped by channel
โ โโโ titles.md # Videos alphabetically
โโโ categories/
โโโ index.md # All categories with links
2. Add Books
Option A: Add a Single Book File
# Add a single book (auto-detects metadata)
rl book add /path/to/book.epub
# Add a book with manual metadata and tags
rl book add /path/to/book.pdf \
--author "John Smith" \
--categories "Programming,Python" \
--tags "beginner,tutorial"
Option B: Import from a Structured Folder
If you have books organized in folders with summaries:
# Import a book from a structured folder
rl book import-folder /path/to/book-folder
# Example folder structure:
# my-book/
# โโโ my-book.epub # Main book file
# โโโ my-book.pdf # Alternative format
# โโโ my-book-summary-shortform.pdf # Summary files
# โโโ my-book-summary-claude.md
# With categories and metadata
rl book import-folder ./python-programming \
--categories "Programming,Python" \
--tags "beginner,tutorial"
The import-folder command will:
- Auto-detect all book formats (PDF, EPUB, Markdown)
- Auto-detect summary files (folder-name-summary-type.ext)
- Convert summaries to Markdown if needed
- Extract chapters from EPUB files
- Auto-detect metadata from EPUB or text content
**Note:** Both `book add` and `book import-folder` create the same organized structure:
```text
books/author-lastname-firstname/book-title/
โโโ full-book-formats/ # All book formats
โ โโโ book-title.epub # Original EPUB
โ โโโ book-title.pdf # Original PDF
โ โโโ book-title.md # Extracted Markdown
โ โโโ chapters/ # Extracted chapters (from EPUB)
โ โโโ 01-chapter-one.md
โ โโโ 02-chapter-two.md
โ โโโ ...
โโโ summaries/ # Book summaries
โ โโโ shortform-summary.md
โ โโโ claude-summary.md
โโโ manifest.yaml # Book metadata
3. Add YouTube Videos
Note: You need a YouTube Data API key. Get one from https://console.cloud.google.com/ and set:
export YOUTUBE_API_KEY="your-api-key-here"
Then fetch videos:
# Fetch a single video by URL
rl video fetch https://www.youtube.com/watch?v=VIDEO_ID
# Fetch by video ID
rl video fetch VIDEO_ID
# Fetch with categories and tags
rl video fetch "https://youtu.be/VIDEO_ID" \
--categories "Education,Programming" \
--tags "tutorial,python"
4. Browse Your Library
# List all books
rl book list
# List books with filters
rl book list --author "John Smith"
rl book list --category "Programming"
rl book list --tag "python"
# List all videos
rl video list
# List videos with filters
rl video list --channel "Tech Channel"
rl video list --category "Education"
rl video list --tag "tutorial"
5. Access Content
# Get book content (displays or saves to file)
rl book get "Python Programming"
rl book get "Python Programming" --output /path/to/output.md
# Get video transcript (displays or saves to file)
rl video get "Video Title"
rl video get "Video Title" --output /path/to/transcript.txt
6. Manage the Catalog
# Rebuild catalog from filesystem (if it gets out of sync)
rl catalog rebuild
# View library statistics
rl catalog stats
The catalog is automatically updated when you add books or fetch videos. The rebuild command scans your library directory and regenerates the catalog from scratch, which is useful if:
- You manually moved files around
- The catalog file was deleted or corrupted
- You want to ensure catalog is in perfect sync with the filesystem
Library Structure
Your library is organized in a clear filesystem hierarchy:
my-library/
โโโ README.md # Root library index with stats & recent additions
โโโ catalog.yaml # Searchable library catalog
โโโ _index/ # Library-wide navigation
โโโ books/
โ โโโ _index/ # Book-wide indices
โ โ โโโ authors.md # Books grouped by author
โ โ โโโ titles.md # Books alphabetically
โ โโโ smith-john/ # Books organized by author
โ โโโ python-programming/
โ โโโ manifest.yaml # Book metadata
โ โโโ full-book-formats/ # All book formats
โ โ โโโ python-programming.epub
โ โ โโโ python-programming.pdf
โ โ โโโ python-programming.md
โ โ โโโ chapters/ # Extracted chapters
โ โ โโโ 01-introduction.md
โ โ โโโ 02-basics.md
โ โโโ summaries/ # Book summaries
โ โโโ shortform-summary.md
โโโ videos/
โ โโโ _index/
โ โ โโโ channels.md # Videos grouped by channel
โ โ โโโ titles.md # Videos alphabetically
โ โโโ tech-channel__UCxxxxx/ # Videos organized by channel
โ โโโ index.md # Channel navigation page
โ โโโ video-title/
โ โโโ manifest.yaml # Video metadata
โ โโโ transcript.md # Video transcript
โโโ categories/
โโโ index.md # All categories with links
Command Reference
Get help on any command:
rl --help # All commands
rl --version # Show version (also: -v)
rl book --help # Book commands
rl video --help # Video commands
rl catalog --help # Catalog commands
Available Commands
General:
rl --version(or-v) - Show version information
Library Management:
rl init <path>- Initialize a new library
Book Commands:
rl book add <file>- Add a book to the libraryrl book list- List all books (with filters)rl book get <title>- Retrieve book content
Video Commands:
rl video fetch <url>- Fetch a YouTube video transcriptrl video list- List all videos (with filters)rl video get <title>- Retrieve video transcript
Catalog Commands:
rl catalog rebuild- Rebuild catalog from filesystemrl catalog stats- Show library statistics
Note: Some commands are still in development. See docs/CLI_COMMANDS_ANALYSIS.md for the full roadmap.
Documentation
For Users
- Installation & Quick Start - Get started quickly
- Command Reference - Available CLI commands
- Library Structure - How your library is organized
For Developers
- Getting Started - Developer onboarding and setup
- Architecture - System design and structure
- Dependencies - Package choices and rationale
- Parsing - Document parsing implementation
Development Workflow
Running Tests and Checks Locally
Before pushing code, run all CI/CD checks locally:
# Quick check script (recommended)
./check.sh
# Or manually:
source venv/bin/activate
ruff check . # Linting
ruff format --check . # Formatting check
pytest --cov=src/resourcelibrarian # Tests with coverage
Pre-Push Hook
The project includes a pre-push Git hook that automatically runs all checks before pushing to remote. This prevents failed CI/CD builds:
- โ
Automatically runs on
git push - โ Blocks push if linting, formatting, or tests fail
- โ
Located at
.git/hooks/pre-push
The hook runs:
- Ruff linting (
ruff check .) - Ruff formatting check (
ruff format --check .) - Full test suite with coverage (
pytest)
If any check fails, the push is aborted with clear error messages.
Creating Releases
The project uses GitHub Releases to automatically publish to PyPI:
- Update version in
pyproject.toml - Create a git tag:
git tag -a v0.2.0 -m "Release v0.2.0" - Push the tag:
git push origin v0.2.0 - Create GitHub Release (triggers auto-publish to PyPI)
See RELEASE.md for detailed instructions on:
- Setting up PyPI trusted publishing
- Creating releases via GitHub UI or CLI
- Version numbering guidelines
- Testing before release
License
TBD
Author
Kenny Wilson
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file resource_librarian-0.1.0.tar.gz.
File metadata
- Download URL: resource_librarian-0.1.0.tar.gz
- Upload date:
- Size: 105.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55fe1b444ecc572ceee198e49ab2c94b9a64aeb109be897027bed621869ed0cf
|
|
| MD5 |
656c409b3048df77d861a50a5fd53d7a
|
|
| BLAKE2b-256 |
fdcf9a8f46897e1afb52468145d7a7e9e56789d7e06cefbd0a7de3dba6f63c50
|
File details
Details for the file resource_librarian-0.1.0-py3-none-any.whl.
File metadata
- Download URL: resource_librarian-0.1.0-py3-none-any.whl
- Upload date:
- Size: 47.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7162a7143fd1c0291297e4f79d3570f4549a578675af4a844acde59572e59f0a
|
|
| MD5 |
e00033da124f5445c1ecedfce6ce1b0f
|
|
| BLAKE2b-256 |
85a478c62f23245e6d6b5c61f2e284542c1c51c703a51453b7d04d93c23b0103
|