How nrafinia/emby.subtitle.subscene works
The Emby.Subtitle.Subscene project is a plugin designed to integrate with the Emby media server, providing subtitle support by retrieving subtitles from the Subscene service. The README makes it clear that the primary purpose is to offer subtitle support for a wide range of languages, while the file tree reveals a focused structure with a single solution that encapsulates models, providers, and integration entry points.
Main Components
• Plugin Interface: At the heart is the Plugin (Plugin.cs) which acts as the integration point with Emby.
• Models: The Models folder holds data entities such as FindMovie, MovieInformation, TvEpisodeResult, etc. These represent the key data structures used throughout the plugin.
• Providers: The Providers folder contains the logic to interact with external services, split into components for movies (SubsceneSubtitleProviderMovie) and TV shows (SubsceneSubtitleProviderTV) along with general utilities (Tools.cs). Additionally, there is a MovieDb component which likely handles interactions with a movie database.
• Test Suite: The Test folder contains various tests targeting the providers and overall functionality, which is useful for verifying the integration and functionality of the plugin.
Relationships and Interactions
• The Plugin component acts as the entry point and orchestrates operations using functions provided by the underlying providers.
• The Providers (movie and TV specific) are responsible for fetching and processing subtitles, relying on Models to structure any data retrieved.
• Utility functions in Tools (and possibly MovieDb) support these providers by handling external API calls or additional data processing.
• The Tests section, although not part of the runtime architecture, verifies that the internal interactions (Plugin → Providers → Models) are behaving as expected.
Architectural Patterns and Design Principles
• Plugin Architecture: This module-based architecture supports the dynamic addition of features within the Emby ecosystem.
• Separation of Concerns: Models, Providers, and the Plugin itself are clearly separated, allowing for modular development and easier testing.
• Abstraction: Each Provider abstracts the interaction with the external subtitle sources by splitting the concerns for movies and TV episodes.
• Testability: The presence of a dedicated Test project emphasizes the importance of isolated testing of components.
Relevant Technologies and Frameworks
• .NET Framework: The project is implemented in C# (as evident from the .csproj and solution files).
• NCrunch: Configuration files (.ncrunchproject) indicate usage of NCrunch for continuous testing.
• (Implicit) HTTP or Web Request Components: Providers likely use HTTP calls to interact with Subscene, although the implementation details might be abstracted away.