How tyrrrz/youtubedownloader works
Main Components
• User Interface (UI) Layer: Represented by the “YoutubeDownloader” project, this layer incorporates:
• Views (axaml files and their code-behinds in the Views folder)
• ViewModels (under ViewModels and its subdirectories)
• Converters (in YoutubeDownloader/Converters)
• Dialogs, custom controls, and any UI-related framework components (e.g., ThemeVariant, DialogManager, ViewManager in the Framework folder)
• Core Business Logic Layer: Found in “YoutubeDownloader.Core”, it is divided into:
• Downloading Component (handles video downloads, download options, and supported quality via classes like VideoDownloader, VideoQualityPreference, etc.)
• Query Resolving Component (in the Resolving directory for handling URL or search query parsing and results)
• Tagging Component (for managing media metadata injection using MusicBrainz, etc.)
• Utility Components (various helper methods and extensions located in the Utils subfolders)
• Services and Application Support: In the “YoutubeDownloader/Services” folder, services such as SettingsService and UpdateService manage configuration and update functionalities.
• External Dependencies:
• YoutubeExplode: Used indirectly within the core to interact with YouTube (as noted in the README).
• FFmpeg: Bundled (and optionally external) for processing video files.
• Other Dependencies: The project also utilizes community and language runtime libraries (reflected in .csproj and Directory.Build.props files).
Relationships and Interactions
• The UI Layer (views and viewmodels) interacts with the Services to request downloads and updates.
• The viewmodels delegate core functionalities (downloading, query resolution, and tagging) to the YoutubeDownloader.Core library.
• Within the Core layer:
• The Downloading module invokes FFmpeg (via DownloadFFmpeg.ps1 script and the FFmpeg integration class) for video processing.
• The Resolving module processes URLs or search queries and classifies the result (using QueryResult, QueryResultKind, etc.).
• The Tagging module enriches the downloaded media files with metadata obtained via external APIs (like MusicBrainz).
• Utility modules are used throughout both layers to support operations such as HTTP requests, path manipulations, and asynchronous patterns.
Architectural Patterns and Design Principles
• MVVM (Model-View-ViewModel): Evident from the separate Views and ViewModels folders, supporting UI/data binding.
• Layered Separation: The clear partition between the UI/application layer (YoutubeDownloader) and the business logic/core layer (YoutubeDownloader.Core) embodies separation of concerns.
• Modularity: Core functions (downloading, resolving, tagging) are wrapped in their own modules, and utilities are grouped separately.
• Dependency Management: Use of external libraries (YoutubeExplode, FFmpeg) is abstracted away inside core functionalities to keep a clean separation.