pub struct MatchArgs {
pub path: PathBuf,
pub dry_run: bool,
pub confidence: u8,
pub recursive: bool,
pub backup: bool,
pub copy: bool,
pub move_files: bool,
}Expand description
Arguments for AI-powered subtitle file matching and renaming.
This structure defines all command-line options available for the match
subcommand, which uses artificial intelligence to analyze video and subtitle
files and automatically rename subtitles to match their corresponding videos.
§Operation Modes
- Normal Mode: Performs actual file operations
- Dry Run Mode: Simulates operations without making changes (
--dry-run) - Recursive Mode: Processes subdirectories (
--recursive) - Backup Mode: Creates backups before renaming (
--backup) - Copy Mode: Copy matched subtitle files to video folders (
--copy) - Move Mode: Move matched subtitle files to video folders (
--move)
§AI Matching Process
- Scans the target directory for video and subtitle files
- Extracts content samples from both file types
- Uses AI to analyze content similarity
- Matches files based on confidence threshold
- Renames subtitle files to match video file names
- Optionally relocates subtitle files to video directories
§Examples
# Basic matching in current directory
subx match ./videos
# Dry run with high confidence threshold
subx match ./videos --dry-run --confidence 90
# Recursive matching with backup and copy to video folders
subx match ./media --recursive --backup --copyFields§
§path: PathBufTarget directory path containing video and subtitle files.
The directory should contain both video files and subtitle files that need to be matched and renamed. Supported video formats include MP4, MKV, AVI, etc. Supported subtitle formats include SRT, ASS, VTT, etc.
dry_run: boolEnable dry-run mode to preview operations without making changes.
When enabled, the command will analyze files and show what operations would be performed, but won’t actually rename any files. This is useful for testing matching accuracy before committing to changes.
confidence: u8Minimum confidence threshold for file matching (0-100).
Only file pairs with similarity confidence above this threshold will be matched and renamed. Higher values result in more conservative matching with fewer false positives, while lower values are more aggressive but may include incorrect matches.
§Recommended Values
- 90-100: Very conservative, highest accuracy
- 80-89: Balanced approach (default)
- 70-79: More aggressive matching
- Below 70: Not recommended for automatic operations
recursive: boolRecursively process subdirectories.
When enabled, the matching process will descend into subdirectories and process video and subtitle files found there. Each subdirectory is processed independently, so files are only matched within the same directory level.
backup: boolCreate backup copies of original files before renaming.
When enabled, original subtitle files are copied to .bak files
before being renamed. This provides a safety net in case the
matching algorithm makes incorrect decisions.
copy: boolCopy matched subtitle files to the same folder as their corresponding video files.
When enabled along with recursive search, subtitle files that are matched with video files in different directories will be copied to the video file’s directory. This ensures that media players can automatically load subtitles. The original subtitle files are preserved in their original locations. Cannot be used together with –move.
move_files: boolMove matched subtitle files to the same folder as their corresponding video files.
When enabled along with recursive search, subtitle files that are matched with video files in different directories will be moved to the video file’s directory. This ensures that media players can automatically load subtitles. The original subtitle files are removed from their original locations. Cannot be used together with –copy.
Implementations§
Trait Implementations§
Source§impl Args for MatchArgs
impl Args for MatchArgs
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 FromArgMatches for MatchArgs
impl FromArgMatches for MatchArgs
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 MatchArgs
impl RefUnwindSafe for MatchArgs
impl Send for MatchArgs
impl Sync for MatchArgs
impl Unpin for MatchArgs
impl UnwindSafe for MatchArgs
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.