Skip to content

Commit

Permalink
Playlists in CLI version
Browse files Browse the repository at this point in the history
  • Loading branch information
Marekkon5 committed Aug 29, 2024
1 parent 9e77b63 commit 2a7ba81
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/onetagger-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ onetagger-tagger = { path = "../onetagger-tagger" }
onetagger-shared = { path = "../onetagger-shared" }
onetagger-autotag = { path = "../onetagger-autotag" }
onetagger-renamer = { path = "../onetagger-renamer" }
onetagger-playlist = { path = "../onetagger-playlist" }
onetagger-platforms = { path = "../onetagger-platforms" }

[target.'cfg(windows)'.build-dependencies]
Expand Down
18 changes: 16 additions & 2 deletions crates/onetagger-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ fn main() {
Actions::Autotagger { path, .. } => {
let config = action.get_at_config().expect("Failed loading config file!");
debug!("{:?}", config);
let files = AudioFileInfo::get_file_list(&path, config.include_subfolders);

// Get files
let files = if path.is_file() {
onetagger_playlist::get_files_from_playlist_file(path).expect("Not a valid playlist file")
} else {
AudioFileInfo::get_file_list(&path, config.include_subfolders)
};

let rx = Tagger::tag_files(&config, files, Arc::new(Mutex::new(None)));
let start = timestamp!();
for status in rx {
Expand All @@ -64,7 +71,14 @@ fn main() {
// Auth spotify
let spotify = Spotify::try_cached_token(client_id, client_secret)
.expect("Spotify unauthorized, please run the authorize-spotify option or login to Spotify in UI at least once!");
let files = AudioFileInfo::get_file_list(&path, subfolders);

// Get files
let files = if path.is_file() {
onetagger_playlist::get_files_from_playlist_file(path).expect("Not a valid playlist file")
} else {
AudioFileInfo::get_file_list(&path, subfolders)
};

let rx = AudioFeatures::start_tagging(config, spotify, files);
let start = timestamp!();
for status in rx {
Expand Down

0 comments on commit 2a7ba81

Please sign in to comment.