- FastAPI-Backend mit vollständiger ABS v2.x API-Kompatibilität - SQLAlchemy-Models: User, Library, LibraryItem, BookFile, Chapter, Podcast, PodcastEpisode, MediaProgress, Bookmark, PlaybackSession - Auth: JWT-Login (/login, /logout, /api/authorize) - Library + Items Endpoints inkl. camelCase ABS-Response-Format - HLS-Streaming via FFmpeg (POST /api/items/:id/play, Session-Sync) - Me/Progress Endpoints + Lesezeichen - User-Management + Server-Settings (Admin) - Library-Scanner (MP3/WAV Discovery, Hintergrund-Task) - File Watcher (watchdog, 30s Debounce) - Matching-Skelett (MusicBrainz, OpenLibrary, Google Books – Phase 5) - Docker-Setup: backend (Python 3.12+FFmpeg), frontend (React/Vite), nginx Reverse-Proxy auf Port 3000 - setup.sh: Installiert Docker auf Debian/Ubuntu, richtet .env ein Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
from pydantic.alias_generators import to_camel
|
|
from datetime import datetime
|
|
|
|
|
|
class LibraryFolder(BaseModel):
|
|
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
id: str
|
|
full_path: str
|
|
library_id: str = ""
|
|
added_at: int = 0
|
|
|
|
|
|
class LibrarySettings(BaseModel):
|
|
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
cover_aspect_ratio: int = 1
|
|
disable_watcher: bool = False
|
|
skip_matching_media_with_asin: bool = False
|
|
skip_matching_media_with_isbn: bool = False
|
|
auto_scan_cron_expression: str = ""
|
|
audio_files_global_include: list[str] = []
|
|
audio_files_global_exclude: list[str] = []
|
|
metadata_precision: int = 10
|
|
hide_single_book_series: bool = False
|
|
only_show_later_books_in_continue_series: bool = False
|
|
metadata_providers: list[str] = ["google", "audible"]
|
|
prefer_matched_metadata: bool = False
|
|
disable_embed_covers: bool = False
|
|
best_books_matching: bool = False
|
|
|
|
|
|
class LibraryOut(BaseModel):
|
|
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
|
|
id: str
|
|
name: str
|
|
folders: list[LibraryFolder] = []
|
|
display_order: int = 1
|
|
icon: str = "database"
|
|
media_type: str = "book"
|
|
provider: str = "google"
|
|
settings: LibrarySettings = LibrarySettings()
|
|
created_at: int = 0 # ABS nutzt Unix-Timestamps in ms
|
|
last_update: int = 0
|
|
|
|
|
|
class LibraryCreate(BaseModel):
|
|
name: str
|
|
folders: list[dict]
|
|
media_type: str = "book"
|
|
icon: str = "database"
|
|
provider: str = "google"
|
|
|
|
|
|
class LibraryUpdate(BaseModel):
|
|
name: str | None = None
|
|
folders: list[dict] | None = None
|
|
settings: dict | None = None
|
|
|
|
|
|
class LibraryItemsResponse(BaseModel):
|
|
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
|
|
results: list
|
|
total: int
|
|
limit: int
|
|
page: int
|