mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-07-31 09:06:06 -04:00
This PR refactors the movie and tv modules and adds a "common" module for shared logic. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Dedicated import and metadata services for movies and TV; completed-torrent detection and import flows. * **Refactor** * Shared media schemas, models, repository logic and base services consolidated; movie/TV services and routes now delegate to specialised import/metadata services. * **Bug Fixes** * Fixed TV episode-count method name. * **Chores** * Added .DS_Store to ignore list; added module comment. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
24 lines
751 B
Python
24 lines
751 B
Python
from uuid import UUID
|
|
|
|
from sqlalchemy import ForeignKey, PrimaryKeyConstraint, UniqueConstraint
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from media_manager.common.models import MediaFileMixin, MediaMixin
|
|
from media_manager.database import Base
|
|
|
|
|
|
class Movie(Base, MediaMixin):
|
|
__tablename__ = "movie"
|
|
__table_args__ = (UniqueConstraint("external_id", "metadata_provider"),)
|
|
|
|
|
|
class MovieFile(Base, MediaFileMixin):
|
|
__tablename__ = "movie_file"
|
|
__table_args__ = (PrimaryKeyConstraint("movie_id", "file_path_suffix"),)
|
|
|
|
movie_id: Mapped[UUID] = mapped_column(
|
|
ForeignKey(column="movie.id", ondelete="CASCADE"),
|
|
)
|
|
|
|
torrent = relationship("Torrent", back_populates="movie_files", uselist=False)
|