optimize
This commit is contained in:
parent
11a862f6c7
commit
31649314a5
1 changed files with 4 additions and 5 deletions
|
@ -239,12 +239,11 @@ impl Libary {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn clean_lost_files(&self) {
|
pub async fn clean_lost_files(&self) {
|
||||||
// todo : clean
|
|
||||||
// tracks
|
// tracks
|
||||||
for track in Track::find(doc! {}, None).await.unwrap() {
|
for track in Track::find_partial(doc! {}, json!({"path": 1}), None).await.unwrap() {
|
||||||
if !std::path::Path::new(&track.path).exists() {
|
if !std::path::Path::new(&track.path.as_ref().unwrap()).exists() {
|
||||||
log::info!("Cleaning lost {}", track.path);
|
log::info!("Cleaning lost {}", track.path.as_ref().unwrap());
|
||||||
track.delete().await.unwrap();
|
Track::remove(&track._id).await.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// albums
|
// albums
|
||||||
|
|
Loading…
Reference in a new issue