caesura 0.30.2

An all-in-one command line tool to transcode FLAC audio files and upload to gazelle based indexers/trackers
Documentation
use crate::prelude::*;

/// Options for image resizing
#[derive(Options, Clone, Debug, Deserialize, Serialize)]
pub struct FileOptions {
    /// Should compression of images be disabled?
    #[arg(long)]
    pub no_image_compression: bool,

    /// Should transcoded files be renamed?
    ///
    /// If enabled then tracks are renamed into a standardized format: `{number} {title}.{ext}`.
    ///
    /// Multi-disc releases will be organized into `CD1/`, `CD2/` subfolders.
    ///
    /// - `1 Example track title.flac`
    /// - `CD1/10 Example track title.mp3`
    #[arg(long)]
    pub rename_tracks: bool,

    /// Maximum file size in bytes beyond which images are compressed.
    ///
    /// Only applies to image files.
    #[arg(long)]
    #[options(default = 750_000)]
    pub max_file_size: u64,

    /// Maximum size in pixels for images.
    ///
    /// Only applied if the image is greater than `max_file_size`.
    #[arg(long)]
    #[options(default = 1280)]
    pub max_pixel_size: u32,

    /// Quality percentage to apply for jpg compression.
    ///
    /// Only applied if the image is greater than `max_file_size`.
    #[arg(long)]
    #[options(default = 80)]
    pub jpg_quality: u8,

    /// Should conversion of png images to jpg be disabled?
    ///
    /// Only applied if the image is greater than `max_file_size`.
    #[arg(long)]
    pub no_png_to_jpg: bool,
}

impl FileOptions {
    /// Default maximum file size in bytes beyond which images are compressed.
    pub const DEFAULT_MAX_FILE_SIZE: u64 = 750_000;
    /// Default maximum size in pixels for images.
    pub const DEFAULT_MAX_PIXEL_SIZE: u32 = 1280;
    /// Default quality percentage for JPG compression.
    pub const DEFAULT_JPG_QUALITY: u8 = 80;
}

impl OptionsContract for FileOptions {
    type Partial = FileOptionsPartial;
    fn validate(&self, _validator: &mut OptionsValidator) {}
}