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) {
|
||||
// todo : clean
|
||||
// tracks
|
||||
for track in Track::find(doc! {}, None).await.unwrap() {
|
||||
if !std::path::Path::new(&track.path).exists() {
|
||||
log::info!("Cleaning lost {}", track.path);
|
||||
track.delete().await.unwrap();
|
||||
for track in Track::find_partial(doc! {}, json!({"path": 1}), None).await.unwrap() {
|
||||
if !std::path::Path::new(&track.path.as_ref().unwrap()).exists() {
|
||||
log::info!("Cleaning lost {}", track.path.as_ref().unwrap());
|
||||
Track::remove(&track._id).await.unwrap();
|
||||
}
|
||||
}
|
||||
// albums
|
||||
|
|
Loading…
Reference in a new issue