Files
KiraTV/backend/models/jellyfin.py
T
joaquin f5d6745ed0 Initial commit: KiraTV IPTV proxy server
Full-stack IPTV management system with Xtream Codes API compatibility,
multi-account provider fan-out, Jellyfin local library integration,
real-time dashboard, EPG support, and A/V-sync-safe stream recovery.
2026-05-17 23:22:05 +02:00

48 lines
2.0 KiB
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime, Text, ForeignKey, func
from sqlalchemy.orm import relationship
from ..database import Base
class JellyfinConfig(Base):
__tablename__ = "jellyfin_configs"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(200), nullable=False)
url = Column(String(500), nullable=False)
api_key = Column(String(300), nullable=False)
is_active = Column(Boolean, default=True, nullable=False)
movies_library_id = Column(String(100), nullable=True)
series_library_id = Column(String(100), nullable=True)
movies_category_name = Column(String(200), default="Películas KiraTV", nullable=False)
series_category_name = Column(String(200), default="Series KiraTV", nullable=False)
last_sync_at = Column(DateTime(timezone=True), nullable=True)
# Dummy ProviderAccount auto-created to satisfy ChannelProviderMap FK
provider_account_id = Column(
Integer,
ForeignKey("provider_accounts.id", ondelete="SET NULL"),
nullable=True,
)
created_at = Column(DateTime(timezone=True), server_default=func.now())
items = relationship("JellyfinItem", back_populates="config", cascade="all, delete-orphan")
class JellyfinItem(Base):
__tablename__ = "jellyfin_items"
id = Column(Integer, primary_key=True, index=True)
jellyfin_config_id = Column(
Integer, ForeignKey("jellyfin_configs.id", ondelete="CASCADE"), nullable=False
)
channel_id = Column(
Integer, ForeignKey("channels.id", ondelete="CASCADE"), nullable=True
)
jellyfin_item_id = Column(String(100), nullable=False, index=True) # Jellyfin hex ID
item_type = Column(String(20), nullable=False) # "movie" | "series"
plot = Column(Text, nullable=True)
year = Column(Integer, nullable=True)
genres = Column(String(500), nullable=True)
rating = Column(String(20), nullable=True)
config = relationship("JellyfinConfig", back_populates="items")