From f3afc5431f37c4b5e8a5fc1524fd79e20d8b5463 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 9 Dec 2023 18:17:23 +0100 Subject: [PATCH] fix genre id generation --- migration/src/m20231126_000002_genres.rs | 2 +- server/src/import/search_result.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/src/m20231126_000002_genres.rs b/migration/src/m20231126_000002_genres.rs index 1c04c60..76f1f10 100644 --- a/migration/src/m20231126_000002_genres.rs +++ b/migration/src/m20231126_000002_genres.rs @@ -69,7 +69,7 @@ macro_rules! relationalize { all_genres.dedup(); let all_genres: Vec<[SimpleExpr; 3]> = all_genres .into_iter() - .map(|g| [sha256::digest(&g).into(), g.to_owned().into(), g.into()]) + .map(|g| [sha256::digest(&g).into(), g.into(), "".into()]) .collect(); let mut builder = sea_query::Query::insert() .into_table(GenreEntity) diff --git a/server/src/import/search_result.rs b/server/src/import/search_result.rs index fce81ee..c2398ca 100644 --- a/server/src/import/search_result.rs +++ b/server/src/import/search_result.rs @@ -186,7 +186,8 @@ impl From for SearchResult { ); for genre in track.recording.genres.to_owned().unwrap_or_default().iter() { - let id = sha256::digest(&genre.disambiguation); + let id = + sha256::digest(format!("{}{}", genre.name, genre.disambiguation).as_str()); if !genres.contains_key(&id) { genres.insert( id.clone(),