mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 21:57:06 +02:00
ListenBrainz: Support import of loves without recording MBID
This commit is contained in:
parent
1b5ea241b6
commit
4d18a207ee
6 changed files with 68 additions and 5 deletions
|
@ -132,15 +132,23 @@ func (b ListenBrainzApiBackend) ImportLoves(loves []models.Love, oldestTimestamp
|
|||
continue
|
||||
}
|
||||
|
||||
// TODO: Support love import without recording MBID
|
||||
if love.RecordingMbid != "" {
|
||||
recordingMbid := string(love.RecordingMbid)
|
||||
|
||||
if recordingMbid == "" {
|
||||
lookup, err := b.client.Lookup(love.TrackName, love.ArtistName())
|
||||
if err == nil {
|
||||
recordingMbid = lookup.RecordingMbid
|
||||
}
|
||||
}
|
||||
|
||||
if recordingMbid != "" {
|
||||
ok := false
|
||||
errMsg := ""
|
||||
if existingMbids[string(love.RecordingMbid)] {
|
||||
if existingMbids[recordingMbid] {
|
||||
ok = true
|
||||
} else {
|
||||
resp, err := b.client.SendFeedback(Feedback{
|
||||
RecordingMbid: string(love.RecordingMbid),
|
||||
RecordingMbid: recordingMbid,
|
||||
Score: 1,
|
||||
})
|
||||
ok = err == nil && resp.Status == "ok"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue