Skip to content

Commit

Permalink
fix genre id generation
Browse files Browse the repository at this point in the history
  • Loading branch information
lucat1 committed Dec 9, 2023
1 parent a0a2cd7 commit f3afc54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion migration/src/m20231126_000002_genres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion server/src/import/search_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ impl From<musicbrainz::Release> 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(),
Expand Down

0 comments on commit f3afc54

Please sign in to comment.