Formatting
This commit is contained in:
@@ -7,7 +7,11 @@ use crate::error::WatchResult;
|
||||
|
||||
/// Normalize a string for fuzzy comparison: NFC unicode, lowercase, trim.
|
||||
pub fn normalize(s: &str) -> String {
|
||||
s.nfc().collect::<String>().to_lowercase().trim().to_string()
|
||||
s.nfc()
|
||||
.collect::<String>()
|
||||
.to_lowercase()
|
||||
.trim()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
/// Check if an artist is "owned" — i.e., any tracks by this artist exist in the indexed library.
|
||||
@@ -52,7 +56,9 @@ pub async fn album_is_owned(
|
||||
let norm_album = normalize(album_name);
|
||||
|
||||
// Try exact lookup
|
||||
if let Some(album) = queries::albums::find_by_name_and_artist(conn, album_name, artist_name).await? {
|
||||
if let Some(album) =
|
||||
queries::albums::find_by_name_and_artist(conn, album_name, artist_name).await?
|
||||
{
|
||||
let tracks = queries::tracks::get_by_album(conn, album.id).await?;
|
||||
if !tracks.is_empty() {
|
||||
return Ok(true);
|
||||
|
||||
Reference in New Issue
Block a user