diff --git a/src/library/mod.rs b/src/library/mod.rs index fe90f3a..d2c4131 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -278,14 +278,24 @@ impl Libary { .await .unwrap() { - if Track::find_partial(doc! { "artist_id": artist.reference()}, json!({}), None, None) + if Track::find_partial( + doc! { "artist_id": artist.reference()}, + json!({}), + None, + None, + ) + .await + .unwrap() + .is_empty() + && Album::find_partial( + doc! { "artist_id": artist.reference()}, + json!({}), + None, + None, + ) .await .unwrap() .is_empty() - && Album::find_partial(doc! { "artist_id": artist.reference()}, json!({}), None, None) - .await - .unwrap() - .is_empty() { log::info!( "Cleaning artist {} with no tracks or albums", diff --git a/src/library/track.rs b/src/library/track.rs index e4f16d7..1b30d5d 100644 --- a/src/library/track.rs +++ b/src/library/track.rs @@ -90,7 +90,7 @@ impl Track { "album_id": None:: }, None, - None + None, ) .await .unwrap() diff --git a/src/route/admin.rs b/src/route/admin.rs index 2c0f70c..a434b40 100644 --- a/src/route/admin.rs +++ b/src/route/admin.rs @@ -24,7 +24,7 @@ pub async fn get_singles_route(u: User) -> FallibleApiResponse { let singles = Track::find( doc! { "album_id": None::, "artist_id": {"$ne": None:: }}, None, - None + None, ) .await .unwrap(); diff --git a/src/route/playlist.rs b/src/route/playlist.rs index 8a205bd..eb87bf5 100644 --- a/src/route/playlist.rs +++ b/src/route/playlist.rs @@ -19,7 +19,10 @@ use super::ToAPI; #[get("/playlists")] pub async fn playlists_route(u: User) -> FallibleApiResponse { - let mut playlists = vec![json!({"id": "recent", "name": "Recently Played"})]; + let mut playlists = vec![ + json!({"id": "recent", "name": "Recently Played"}), + json!({"id": "recentlyAdded", "name": "Recently Added"}), + ]; let own_playlists = Playlist::find(doc! { "owner": u.reference()}, None, None) .await