stream-fusion-better/stream_fusion/services/postgresql/models/mismatch_model.py
LimeDrive b8399900d5 feat: add mismatches management and unmatched torrents search
- Implemented a new admin page for managing TMDB mismatches, including listing, creating, and deleting mismatches.
- Added functionality to search for unmatched torrents with filters for language and type.
- Enhanced UI with improved filtering options and group toggling for better user experience.
- Introduced toast notifications for user actions such as creating mismatches and assigning TMDB IDs.
- Updated backend routes to handle mismatch creation, deletion, and assignment of TMDB IDs to selected torrents.
2026-04-01 17:51:15 +02:00

31 lines
1.3 KiB
Python

import time
from typing import Optional
from sqlalchemy import BigInteger, Integer, String, Text, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column
from stream_fusion.services.postgresql.base import Base
class TmdbMismatchModel(Base):
"""Admin-reported (info_hash, tmdb_id) pairs that are known mismatches.
When a torrent is flagged here, it will never be re-assigned to that
TMDB ID by the automatic enrichment pipeline.
"""
__tablename__ = "tmdb_mismatches"
__table_args__ = (
UniqueConstraint("info_hash", "tmdb_id", name="uq_mismatch_hash_tmdb"),
)
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
info_hash: Mapped[str] = mapped_column(String(40), nullable=False, index=True)
tmdb_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
raw_title: Mapped[str] = mapped_column(String, nullable=False)
indexer: Mapped[str] = mapped_column(String, nullable=False)
notes: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
created_at: Mapped[int] = mapped_column(BigInteger, nullable=False)
def __init__(self, **kwargs):
if "created_at" not in kwargs:
kwargs["created_at"] = int(time.time())
super().__init__(**kwargs)