Skip to main content

Crate moosicbox_files

Crate moosicbox_files 

Source
Expand description

File handling utilities for MoosicBox music server.

This crate provides comprehensive file operations for the MoosicBox music server, including:

  • HTTP file operations - Download and stream files from remote URLs with progress tracking
  • Media cover images - Fetch and cache album/artist cover artwork
  • Audio file handling - Process and serve audio tracks in various formats
  • Byte range support - Handle partial content requests for streaming media

§Features

  • api - Actix-web HTTP endpoints for file services
  • files - Core file handling and track management
  • range - Byte range parsing for partial content requests
  • image / libvips - Image resizing and processing
  • Format-specific features: format-aac, format-flac, format-mp3, format-opus

§Examples

Download and save a file from a remote URL:

let client = switchy_http::Client::new();
let file_path = std::path::Path::new("/tmp/audio.flac");
let url = "https://example.com/audio.flac";

fetch_and_save_bytes_from_remote_url(&client, file_path, url, None).await?;

Modules§

api
HTTP API endpoints for file services using Actix-web.
files
Core file handling operations for tracks, albums, and artists.
range
Byte range parsing for HTTP partial content requests.

Structs§

CoverBytes
Cover image bytes with optional size information.

Enums§

FetchAndSaveBytesFromRemoteUrlError
Errors that can occur when fetching and saving bytes from a remote URL.
FetchCoverError
Errors that can occur when fetching cover artwork.
GetContentLengthError
Errors that can occur when retrieving content length from a remote URL.
SaveBytesStreamToFileError
Errors that can occur when saving a byte stream to a file.

Functions§

fetch_and_save_bytes_from_remote_url
Downloads bytes from a remote URL and saves them to a file.
fetch_bytes_from_remote_url
Fetches bytes from a remote URL as a stream.
get_content_length
Retrieves the content length of a remote resource via HTTP HEAD request.
sanitize_filename
Sanitizes a filename by replacing all non-alphanumeric characters with underscores.
save_bytes_stream_to_file
Saves a stream of bytes to a file, optionally starting at a byte offset.
save_bytes_stream_to_file_with_progress_listener
Saves a stream of bytes to a file with progress tracking.
save_bytes_stream_to_file_with_speed_listener
Saves a stream of bytes to a file with download speed and progress callbacks.
save_bytes_to_file
Saves bytes to a file at the specified path, optionally starting at a byte offset.
search_for_cover
Searches for cover artwork in a directory or extracts it from audio file tags.