Files
Audiolib/backend/app/schemas/library.py
Audiolib 6bb07ff873 Case-insensitive login, auto-matching after scan, per-library sources
- auth: username lookup is now case-insensitive via func.lower()
- scanner: trigger match_audiobook for each newly found item after scan
- matcher: read match_sources from library settings; refactored to loop
  over configured sources in priority order instead of hardcoded sequence
- schemas/routers: expose matchSources in LibraryOut API response
- Admin UI: pill-toggle for MusicBrainz/Open Library/Google Books per library

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 15:01:56 +02:00

70 lines
2.0 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"
match_sources: list[str] = ["musicbrainz", "open_library", "google_books"]
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
media_type: str | 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