Add Docs module for searching and organizing PDFs and EPUBs

Create a new Docs module that consolidates PDF and eBook handling into a
unified system with subjects and authors support. This replaces the
separate PDF/eBook modelers with a single Doc model backed by an
alembic migration (rename ebook to doc).

Key changes:
- New modules/docs package with models, API, extractors, and lib
- Subject and author metadata extraction with case-insensitive
  normalization for cleaner PDF metadata
- Frontend Docs pages with AuthorsPage, SubjectsPage using
  CollectionTable, and doc card deletion
- Global search integration for subjects and authors
- Generic collection item count support
- Frontend file card metadata adjusted to match collection sort
- Bump yt-dlp version
This commit is contained in:
Roland 2026-03-17 18:35:57 -06:00
parent 4a21499bdd
commit aefc7b1def
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
90 changed files with 4484 additions and 1189 deletions

26
modules/docs/conftest.py Normal file
View file

@ -0,0 +1,26 @@
import pytest
from modules.docs.models import Doc
@pytest.fixture
def doc_factory(test_session, test_directory):
"""Factory for creating Doc records for testing."""
count = 0
def factory(file_group=None, **kwargs):
nonlocal count
count += 1
if file_group is None:
from wrolpi.files.models import FileGroup
path = test_directory / f'test_doc_{count}.pdf'
path.write_bytes(b'%PDF-1.4 test')
file_group = FileGroup.from_paths(test_session, path)
test_session.flush()
doc = Doc(file_group=file_group, **kwargs)
test_session.add(doc)
test_session.flush()
return doc
return factory