mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-06-11 09:06:15 -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 -->
35 lines
959 B
Python
35 lines
959 B
Python
from uuid import UUID
|
|
|
|
from sqlalchemy import ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from media_manager.torrent.models import Quality
|
|
|
|
|
|
class MediaMixin:
|
|
"""
|
|
Mixin for common media fields used by both Movies and TV Shows.
|
|
"""
|
|
|
|
id: Mapped[UUID] = mapped_column(primary_key=True)
|
|
external_id: Mapped[int]
|
|
metadata_provider: Mapped[str]
|
|
name: Mapped[str]
|
|
overview: Mapped[str]
|
|
year: Mapped[int | None]
|
|
library: Mapped[str] = mapped_column(default="Default")
|
|
original_language: Mapped[str | None] = mapped_column(default=None)
|
|
imdb_id: Mapped[str | None] = mapped_column(default=None)
|
|
|
|
|
|
class MediaFileMixin:
|
|
"""
|
|
Mixin for common media file fields used by both Movie files and Episode files.
|
|
"""
|
|
|
|
file_path_suffix: Mapped[str]
|
|
quality: Mapped[Quality]
|
|
torrent_id: Mapped[UUID | None] = mapped_column(
|
|
ForeignKey(column="torrent.id", ondelete="SET NULL"),
|
|
)
|