Downloads
The download manager orchestrates background fetching for offline consumption of Anime episodes and Manga chapters.
Architecture
Downloads execute asynchronously and independently of the active UI, managed within lib/features/downloads/.
- Queueing: A user queues an episode. A
DownloadTaskrecord is inserted into Isar with apendingstate. - Execution: The
DownloadServicepolls for pending tasks. When a slot opens, it initiates the network stream. - File Management: Media is streamed directly to the device's persistent storage. For Manga, images are downloaded into a structured directory or archived (e.g., CBZ).
- Completion: The
DownloadTaskis markedcompletedand the local file URI is recorded.
Integration
When the user requests to play media, the engine queries the DownloadTask database. If a completed task exists, the engine overrides the remote URL with the local file path, entirely bypassing network resolution and tracking synchronization for that specific stream request.