-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
treewide: Reorganise code so types are colocated
- Loading branch information
Showing
7 changed files
with
101 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use clap::Parser; | ||
use std::path::PathBuf; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(author, version, about, long_about = None)] | ||
pub struct Config { | ||
#[arg( | ||
long, | ||
short = 'n', | ||
help = "Don't actually rename or tag files, only display what would happen" | ||
)] | ||
pub dry_run: bool, | ||
|
||
#[arg( | ||
long, | ||
short, | ||
help = "Ignore .lastmack timestamp, run on all files present regardless" | ||
)] | ||
pub force: bool, | ||
|
||
#[arg( | ||
long, | ||
short, | ||
help = "Use a different output directory (by default, it's the same as the input dir)" | ||
)] | ||
pub output_dir: Option<PathBuf>, | ||
|
||
/// The format to apply to files, excluding the extension. | ||
/// | ||
/// Substitutions can be applied inside curly brackets, for example with {artist} to get the | ||
/// track artist. Any formats returning data with "/" will have it transformed to "_". | ||
/// | ||
/// Available formats: | ||
/// | ||
/// TAG: | ||
/// | ||
/// artist | ||
/// album | ||
/// track (width: 2) | ||
/// title | ||
/// | ||
/// LITERAL: | ||
/// | ||
/// {{ and }} indicate literal brackets. | ||
#[arg( | ||
long, | ||
verbatim_doc_comment, | ||
default_value = "{artist}/{album}/{track} {title}" | ||
)] | ||
pub fmt: String, | ||
|
||
#[arg(help = "Directories to find music files in.")] | ||
pub paths: Option<Vec<PathBuf>>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use crate::types::Track; | ||
use crate::track::Track; | ||
use anyhow::Result; | ||
use id3::Tag; | ||
use std::path::PathBuf; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pub mod feat; | ||
pub mod fixers; | ||
pub mod loader; | ||
pub mod rename; | ||
|
||
pub use loader::get_track; | ||
|
||
use id3::Tag; | ||
use std::path::PathBuf; | ||
|
||
/// Represents a music track with its file path and associated ID3 tag. | ||
pub struct Track { | ||
pub path: PathBuf, | ||
pub tag: Tag, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters