Files
Audiolib/backend/app/schemas/library.py
Audiolib 18d1481681 Fix sidebar, add library editing, improve file browser
- Sidebar: show Podcasts section only when podcast libraries exist;
  show hint text when no libraries are configured yet
- Admin: extract LibraryForm component, add edit (Pencil) button per
  library with inline form and PATCH support
- Backend: add media_type to LibraryUpdate schema and PATCH handler
- FileBrowser: add quick-access shortcuts (/audiofiles /data /media /),
  show all files+dirs so users can confirm correct folder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 14:42:35 +02:00

69 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
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