Skip to content

Conversation

@morpheus65535
Copy link
Owner

@morpheus65535 morpheus65535 commented Dec 27, 2025

Summary

This Pull Request refactors the handling of subtitles in the codebase, focusing on enhancing the database representation of subtitles, consolidating subtitle-related logic, and fixing redundancy. It introduces new database tables (TableEpisodesSubtitles and TableMoviesSubtitles) to replace embedded subtitles fields, with corresponding migrations and extensive updates to the surrounding logic for indexing, managing, and querying subtitles.

Main changes:

  • Database Refactoring:
    • Added TableEpisodesSubtitles and TableMoviesSubtitles for externalized, structured storage of subtitles.
    • Removed subtitles fields from TableEpisodes and TableMovies (migrations/versions/0124f9e278fb_.py handles data migration).
  • Subtitle Logic Update:
    • Centralized subtitle retrieval into a newly added get_subtitles utility function.
    • Improved handling of embedded and external subtitles indexing with deduplication logic.
    • Replaced direct parsing of subtitles fields with dedicated relational database operations in multiple modules.
  • Code Adjustments:
    • Revised the store_subtitles and store_subtitles_movie` functions to use the new table structure.
    • Various methods across modules updated to use TableEpisodesSubtitles and TableMoviesSubtitles.
  • Query Optimizations:
    • Removed redundant subtitle parsing logic and adjusted queries to reference the new structured fields.
  • Migration:
    • Alembic migration script provided for converting existing subtitle data to the new schema.

This PR streamlines how subtitles are indexed, stored, and fetched, improving maintainability and resolving potential data redundancy issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants