1745 wystapien w 291 plikach (backend, scripts, mobile). Dominowal jeden ksztalt, ' — ' laczace zdania, wiec poszedl przecinek; myslnik otwierajacy mysl zdjety; zakresy 0–5 i A–Z na dywiz. Podzial komentarz/kod robil skaner stanow, nie regex, zeby nie ruszyc myslnika stojacego w stringu albo w wyrazeniu regularnym. Potwierdzone maszynowo: po wycieciu komentarzy z wersji HEAD i z dysku obie sa identyczne we wszystkich 291 plikach, czyli poza komentarzami nie zmienilo sie nic. 233 pliki .py parsuja sie bez bledu, tsc ma te same 11 bledow w tych samych 3 plikach co przed zmiana. Dwie rzeczy wymagaly poprawki po automacie: wyrownane listy definicji, gdzie myslnik byl separatorem kolumny (37 miejsc, kolumna przywrocona), i trzy przeniesienia mysli do nowej linii, gdzie zostawal wiszacy przecinek na poczatku (poprawione recznie). Bundla nie republikuje: Hermes i tak nie niesie komentarzy, wiec dla uzytkownika to zero zmiany. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
61 lines
2.2 KiB
Python
61 lines
2.2 KiB
Python
"""Pozycja odtwarzania per scena (continue watching)."""
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, String, func
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base
|
|
|
|
|
|
class ScenePlayProgress(Base):
|
|
__tablename__ = "scene_play_progress"
|
|
|
|
device_id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
scene_id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
ForeignKey("scenes.id", ondelete="CASCADE"),
|
|
primary_key=True,
|
|
)
|
|
position_sec: Mapped[int] = mapped_column(
|
|
Integer, nullable=False, server_default="0", default=0
|
|
)
|
|
# Mirror Scene.duration_sec gdy player zwróci ten dato, pozwala na poprawny
|
|
# progress_pct nawet gdy Scene.duration_sec jest None.
|
|
duration_sec: Mapped[int | None] = mapped_column(Integer)
|
|
finished: Mapped[bool] = mapped_column(
|
|
Boolean, nullable=False, server_default="false", default=False
|
|
)
|
|
last_played_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
)
|
|
|
|
|
|
class MoviePlayProgress(Base):
|
|
"""Pozycja odtwarzania per film. Mirror ScenePlayProgress dla movies.
|
|
|
|
User-report 2026-05-26 (b207ff17): "przydałoby się oznaczenie filmów już
|
|
obejrzanych", sceny mają watched badge, filmów brakowało.
|
|
"""
|
|
|
|
__tablename__ = "movie_play_progress"
|
|
|
|
device_id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
movie_id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
ForeignKey("movies.id", ondelete="CASCADE"),
|
|
primary_key=True,
|
|
)
|
|
position_sec: Mapped[int] = mapped_column(
|
|
Integer, nullable=False, server_default="0", default=0
|
|
)
|
|
duration_sec: Mapped[int | None] = mapped_column(Integer)
|
|
finished: Mapped[bool] = mapped_column(
|
|
Boolean, nullable=False, server_default="false", default=False
|
|
)
|
|
last_played_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
)
|