mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-17 19:26:36 -07:00
fix: do not update mbz id when one already exists (#123)
This commit is contained in:
parent
f51771bc34
commit
d61e814306
4 changed files with 99 additions and 12 deletions
|
|
@ -96,6 +96,19 @@ func matchArtistsByMBIDMappings(ctx context.Context, d db.DB, opts AssociateArti
|
|||
})
|
||||
if err == nil {
|
||||
l.Debug().Msgf("Artist '%s' found by Name", a.Artist)
|
||||
if artist.MbzID == nil {
|
||||
err := d.UpdateArtist(ctx, db.UpdateArtistOpts{
|
||||
ID: artist.ID,
|
||||
MusicBrainzID: a.Mbid,
|
||||
})
|
||||
if err != nil {
|
||||
l.Err(err).Msg("matchArtistsByMBIDMappings: failed to update artist with MusicBrainz ID")
|
||||
return nil, fmt.Errorf("matchArtistsByMBIDMappings: %w", err)
|
||||
}
|
||||
l.Debug().Msgf("Updated artist '%s' with MusicBrainz ID", artist.Name)
|
||||
} else {
|
||||
l.Warn().Msgf("Attempted to update artist %s with MusicBrainz ID, but an existing ID was already found", artist.Name)
|
||||
}
|
||||
err = d.UpdateArtist(ctx, db.UpdateArtistOpts{ID: artist.ID, MusicBrainzID: a.Mbid})
|
||||
if err != nil {
|
||||
l.Err(err).Msgf("matchArtistsByMBIDMappings: Failed to associate artist '%s' with MusicBrainz ID", artist.Name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue