Skip to content

Commit 2a7ba81

Browse files
committed
Playlists in CLI version
1 parent 9e77b63 commit 2a7ba81

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/onetagger-cli/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ onetagger-tagger = { path = "../onetagger-tagger" }
1818
onetagger-shared = { path = "../onetagger-shared" }
1919
onetagger-autotag = { path = "../onetagger-autotag" }
2020
onetagger-renamer = { path = "../onetagger-renamer" }
21+
onetagger-playlist = { path = "../onetagger-playlist" }
2122
onetagger-platforms = { path = "../onetagger-platforms" }
2223

2324
[target.'cfg(windows)'.build-dependencies]

crates/onetagger-cli/src/main.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ fn main() {
4545
Actions::Autotagger { path, .. } => {
4646
let config = action.get_at_config().expect("Failed loading config file!");
4747
debug!("{:?}", config);
48-
let files = AudioFileInfo::get_file_list(&path, config.include_subfolders);
48+
49+
// Get files
50+
let files = if path.is_file() {
51+
onetagger_playlist::get_files_from_playlist_file(path).expect("Not a valid playlist file")
52+
} else {
53+
AudioFileInfo::get_file_list(&path, config.include_subfolders)
54+
};
55+
4956
let rx = Tagger::tag_files(&config, files, Arc::new(Mutex::new(None)));
5057
let start = timestamp!();
5158
for status in rx {
@@ -64,7 +71,14 @@ fn main() {
6471
// Auth spotify
6572
let spotify = Spotify::try_cached_token(client_id, client_secret)
6673
.expect("Spotify unauthorized, please run the authorize-spotify option or login to Spotify in UI at least once!");
67-
let files = AudioFileInfo::get_file_list(&path, subfolders);
74+
75+
// Get files
76+
let files = if path.is_file() {
77+
onetagger_playlist::get_files_from_playlist_file(path).expect("Not a valid playlist file")
78+
} else {
79+
AudioFileInfo::get_file_list(&path, subfolders)
80+
};
81+
6882
let rx = AudioFeatures::start_tagging(config, spotify, files);
6983
let start = timestamp!();
7084
for status in rx {

0 commit comments

Comments
 (0)