Skip to main content

## Module download

Source
Expand description

Tauri commands for download operations

## Re-exports§

`pub use pinning::*;`
`pub use smart_cache::*;`

## Modules§

pinning 🔒
  Pinning commands - protect an item’s cached metadata from cache clearing.
smart_cache 🔒
  Smart-cache statistics/config and album recommendation commands.

## Structs§

AlbumStorageInfo
  Storage info for a single album
AlbumTrack 🔒
  One track of an album, as the album-download path queues it.
DownloadItemAndStartRequest
  Request payload for download_item_and_start (bundled to stay within specta’s 10-argument command limit).
DownloadItemRequest
  Request payload for download_item.
DownloadManagerStats
  Download manager statistics
DownloadManagerWrapper
  Wrapper for DownloadManager to be used as Tauri state
DownloadStats
  Download statistics computed server-side
DownloadVideoRequest
  Request payload for download_video.
DownloadsResponse
  Enhanced response with pre-computed stats
NetworkStateWrapper
  Wrapper for the current network transport, used by the WiFi-only gate.
NetworkStateWrapperArg
  Argument struct for `set_network_state`.
StorageStats
  Storage statistics for downloads

## Functions§

album_file_names 🔒
  Queue one download row per track and link every track to its album.
cached_album_tracks 🔒
  The album’s tracks as the local catalog cache knows them.
cancel_download
  Cancel a download
clear_stale_downloads
  Clear all stale pending/failed/paused downloads
compute_download_stats 🔒
  Helper to compute download statistics from a list of downloads
confine_queued_path 🔒
  Sanitize a queued download’s path and confine it to the download directory.
confine_to_root 🔒
  Fold `..` out of `candidate` and require what is left to sit inside `root`.
delete_album_downloads
  Delete all downloads for a specific album
delete_all_downloads
  Delete all downloads for a user
delete_download
  Delete a completed download
delete_downloads_under
  Remove every completed download at or under a container item.
download_album
  Queue an entire album for download.
download_item
  Queue a media item for download
download_item_and_start
  Queue and start a download in a single atomic operation This simplifies the frontend flow by combining multiple steps
download_root 🔒
  The directory every download has to stay inside: the storage root `storage_get_path` hands the frontend, which is the database’s parent.
download_season
  Queue all episodes of a specific season for download
download_series
  Queue all episodes of a series for download
download_video
  Queue a video item (movie or episode) for download with quality preset
downloads_allowed_on_current_network 🔒
  Whether the current network permits downloads, given the user’s WiFi-only preference.
enqueue_download
  Enqueue a download with its resolved stream URL, then let the queue pump start it (or a higher-priority pending item) when a slot is free.
enqueue_video_downloads
  Enqueue a batch of already-queued video downloads, resolving each one’s transcode URL from the repository using the `quality_preset` stored on the row. Then let the pump start them subject to the concurrency limit.
get_download_manager_stats
  Get download manager statistics
get_download_storage_stats
  Get storage statistics for downloads
get_downloads
  Get all downloads for a user, optionally filtered by status
get_downloads_allowed
  Whether downloads are currently permitted by the WiFi-only gate.
map_download_row 🔒
  Helper function to map database row to DownloadInfo
mark_download_completed
  Mark a download as completed
mark_download_failed
  Mark a download as failed
pause_download
  Pause a download.
pump_download_queue 🔒
  Start as many pending downloads as there are free concurrency slots.
queue_album_tracks 🔒
  TRACES: UR-018, UR-055 | DR-173 | UT-170
resume_download
  Resume a paused download.
sanitize_filename 🔒
  Sanitize filename by removing invalid characters
set_max_concurrent_downloads
  Set the maximum concurrent downloads
set_network_state
  Report the device’s current network transport (Android → Rust).
spawn_download_worker 🔒
  Spawn the background worker for one download. On completion or failure it unregisters the slot, emits the terminal event, and pumps the queue so the next pending download starts automatically.
start_download
  Start downloading a file immediately This command actually downloads the file using the worker

## Type Aliases§

EpisodeRow 🔒
  One row of the series episode listing used when queueing a whole series: `(id, name, season_name, index_number, parent_index_number)`.