File cleanup post-parsing (#37)
All checks were successful
Rust Build / Check (push) Successful in 34s
Rust Build / Test Suite (push) Successful in 30s
Rust Build / Rustfmt (push) Successful in 27s
Rust Build / Clippy (push) Successful in 28s
Release Tagging / release (push) Successful in 29s
Rust Build / build (push) Successful in 43s
Rust Build / Check (pull_request) Successful in 33s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Test Suite (pull_request) Successful in 36s
Rust Build / Clippy (pull_request) Successful in 34s
Rust Build / build (pull_request) Successful in 37s

Reviewed-on: #37
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-07-23 20:25:05 +00:00
committed by phoenix
parent 99bb72ffb2
commit 27e4b30d21
4 changed files with 78 additions and 3 deletions

View File

@@ -40,7 +40,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await
{
Ok(_) => {
// TODO: Cleanup files in local filesystem
match cleanup(&song_queue_path, &coverart_queue_path).await {
Ok(_) => {
println!("Successful cleanup");
}
Err(err) => {
eprintln!("Error: {err:?}");
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
@@ -100,6 +107,23 @@ async fn wipe_data_from_queues(
}
}
async fn cleanup(
song_queue_path: &String,
coverart_queue_path: &String,
) -> Result<(), std::io::Error> {
match the_rest::cleanup::clean_song_queue(song_queue_path) {
Ok(_) => {}
Err(err) => {
eprintln!("Error: Problem cleaning up SongQueue files {err:?}");
}
}
match the_rest::cleanup::clean_coverart_queue(coverart_queue_path) {
Ok(_) => Ok(()),
Err(err) => Err(err),
}
}
async fn is_queue_empty(
api_url: &String,
) -> Result<(bool, responses::fetch_next_queue_item::SongQueueItem), reqwest::Error> {