Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update musicbrainz metadata #240

Closed
wants to merge 1 commit into from

Conversation

tpeacock19
Copy link

Currently, the musicbrainz scrobbler is submitting incorrect data. The mappings for this api can be found here:

Json Field      : MusicBrainz Internal Name	: Metadata Tag Name

release_mbid	: musicbrainz_releaseid		: musicbrainz_albumid
recording_mbid	: musicbrainz_recordingid	: musicbrainz_trackid
track_mbid	: musicbrainz_trackid		: musicbrainz_releasetrackid

Gonic submits the metadata tag musicbrainz_trackid (https://github.com/sentriz/gonic/blob/master/scanner/tags/tags.go#L41) as track_mbid (https://github.com/sentriz/gonic/blob/master/scrobble/listenbrainz/listenbrainz.go#L62). But that field actually corresponds to musicbrainz_recordingid. The correct metadata field to use is musicbrainz_releasetrackid.

This PR corrects this and adds two more entries in the AdditionalInfo
struct, RecordingMBID and ReleaseMBID. Reflecting the mapping above.

@sentriz
Copy link
Owner

sentriz commented Oct 8, 2022

hi! thanks for noticing this! i think this solution works well for new installations of gonic, but for existing installations that are upgraded, it would required migrating peoples databases. could get messy

how do you feel about a simpler solution, which is just to submit the recording_mbid to listenbrainz, coming from people's existing track TagBrainzIDs ?

for example

diff --git a/scrobble/listenbrainz/listenbrainz.go b/scrobble/listenbrainz/listenbrainz.go
index 6f17167..73874d1 100644
--- a/scrobble/listenbrainz/listenbrainz.go
+++ b/scrobble/listenbrainz/listenbrainz.go
@@ -27,9 +27,10 @@ var (
 )
 
 type AdditionalInfo struct {
-	TrackNumber int    `json:"tracknumber,omitempty"`
-	TrackMBID   string `json:"track_mbid,omitempty"`
-	TrackLength int    `json:"track_length,omitempty"`
+	TrackNumber   int    `json:"tracknumber,omitempty"`
+	TrackMBID     string `json:"track_mbid,omitempty"`
+	RecordingMBID string `json:"recording_mbid,omitempty"`
+	TrackLength   int    `json:"track_length,omitempty"`
 }
 
 type TrackMetadata struct {
@@ -58,9 +59,9 @@ func (s *Scrobbler) Scrobble(user *db.User, track *db.Track, stamp time.Time, su
 	payload := &Payload{
 		TrackMetadata: &TrackMetadata{
 			AdditionalInfo: &AdditionalInfo{
-				TrackNumber: track.TagTrackNumber,
-				TrackMBID:   track.TagBrainzID,
-				TrackLength: track.Length,
+				TrackNumber:   track.TagTrackNumber,
+				RecordingMBID: track.TagBrainzID,
+				TrackLength:   track.Length,
 			},
 			ArtistName:  track.TagTrackArtist,
 			TrackName:   track.TagTitle,

reference:
https://picard-docs.musicbrainz.org/downloads/MusicBrainz_Picard_Tag_Map.html
https://listenbrainz.readthedocs.io/en/latest/users/json.html#json-doc

@sentriz sentriz closed this in 8ee357b Oct 8, 2022
@sentriz
Copy link
Owner

sentriz commented Oct 8, 2022

did some testing and it seems to work well, so added it to master for now. let me know if that's ok for you. thanks!

@tpeacock19
Copy link
Author

yeah, I did have to switch between the two database versions while I was doing this. I think submitting the recording would be fine. I would suggest including the album ID if possible or else there is no way to differentiate between versions of an album.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants