pub struct ConvertArgs {
pub input: PathBuf,
pub format: Option<OutputSubtitleFormat>,
pub output: Option<PathBuf>,
pub keep_original: bool,
pub encoding: String,
}Expand description
Command-line arguments for subtitle format conversion.
The convert command transforms subtitle files between different formats while preserving timing information and content structure. It supports both single file and batch directory processing.
§Examples
use subx_cli::cli::ConvertArgs;
use subx_cli::cli::OutputSubtitleFormat;
use std::path::PathBuf;
let args = ConvertArgs {
input: PathBuf::from("input.srt"),
format: Some(OutputSubtitleFormat::Ass),
output: Some(PathBuf::from("output.ass")),
keep_original: true,
encoding: "utf-8".to_string(),
};Fields§
§input: PathBufInput file or directory path containing subtitle files.
For single file conversion, specify the exact file path. For batch processing, specify a directory path and all supported subtitle files will be processed.
format: Option<OutputSubtitleFormat>Target output format for converted subtitles.
If not specified, the default format from configuration will be used. Supported formats include SRT, ASS, VTT, and SUB.
§Examples
--format srt # Convert to SubRip format
--format ass # Convert to Advanced SubStation Alpha
--format vtt # Convert to WebVTT format
--format sub # Convert to MicroDVD/SubViewer formatoutput: Option<PathBuf>Output file path for the converted subtitle.
If not specified for single file conversion, the output will use the same name as input with the appropriate extension. For batch processing, files are saved with new extensions in the same directory or a format-specific subdirectory.
keep_original: boolPreserve the original files after conversion.
By default, original files are preserved. Use this flag to explicitly keep originals during batch processing operations.
encoding: StringCharacter encoding for input and output files.
Specifies the character encoding to use when reading input files and writing output files. UTF-8 is the default and recommended encoding for maximum compatibility.
§Supported Encodings
- UTF-8 (default, recommended)
- UTF-16LE, UTF-16BE
- Windows-1252 (Western European)
- ISO-8859-1 (Latin-1)
- GBK, GB2312 (Chinese)
- Shift_JIS (Japanese)
§Examples
--encoding utf-8 # UTF-8 encoding (default)
--encoding windows-1252 # Windows Western European
--encoding gbk # Chinese GBK encodingTrait Implementations§
Source§impl Args for ConvertArgs
impl Args for ConvertArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl Debug for ConvertArgs
impl Debug for ConvertArgs
Source§impl FromArgMatches for ConvertArgs
impl FromArgMatches for ConvertArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Auto Trait Implementations§
impl Freeze for ConvertArgs
impl RefUnwindSafe for ConvertArgs
impl Send for ConvertArgs
impl Sync for ConvertArgs
impl Unpin for ConvertArgs
impl UnwindSafe for ConvertArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.