- 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>
33 lines
1.8 KiB
Python
33 lines
1.8 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
from sqlalchemy import String, Float, Boolean, DateTime, Text, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from ..database import Base
|
|
|
|
|
|
class MediaProgress(Base):
|
|
__tablename__ = "media_progress"
|
|
|
|
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
user_id: Mapped[str] = mapped_column(String(36), ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
|
|
library_item_id: Mapped[str] = mapped_column(String(36), ForeignKey("library_items.id", ondelete="CASCADE"), nullable=False)
|
|
episode_id: Mapped[str | None] = mapped_column(String(36), nullable=True)
|
|
duration: Mapped[float] = mapped_column(Float, default=0.0)
|
|
current_time: Mapped[float] = mapped_column(Float, default=0.0)
|
|
is_finished: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
hide_from_continue_listening: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
started_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
|
last_update: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
finished_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
|
|
|
|
|
class Bookmark(Base):
|
|
__tablename__ = "bookmarks"
|
|
|
|
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
user_id: Mapped[str] = mapped_column(String(36), ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
|
|
library_item_id: Mapped[str] = mapped_column(String(36), ForeignKey("library_items.id", ondelete="CASCADE"), nullable=False)
|
|
time_seconds: Mapped[float] = mapped_column(Float, nullable=False)
|
|
title: Mapped[str] = mapped_column(String(500), nullable=False)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|