This commit is contained in:
JMARyA 2024-08-13 02:11:51 +02:00
parent 11a862f6c7
commit 31649314a5
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -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