[WIP] music platform user data scraper
teal-fm atproto

resolve musicbrainz fields being rendered on empty

Changed files
+16 -16
models
service
lastfm
musicbrainz
spotify
+5 -5
models/track.go
··· 7 7 PlayID int64 `json:"playId"` 8 8 Name string `json:"name"` 9 9 // analogous to "track" 10 - RecordingMBID string `json:"trackMBID"` 10 + RecordingMBID *string `json:"trackMBID,omitempty"` 11 11 Artist []Artist `json:"artist"` 12 12 Album string `json:"album"` 13 13 // analogous to "album" 14 - ReleaseMBID string `json:"releaseMBID"` 14 + ReleaseMBID *string `json:"releaseMBID,omitempty"` 15 15 URL string `json:"url"` 16 16 Timestamp time.Time `json:"timestamp"` 17 17 DurationMs int64 `json:"durationMs"` ··· 22 22 } 23 23 24 24 type Artist struct { 25 - Name string `json:"name"` 26 - ID string `json:"id"` 27 - MBID string `json:"mbid"` 25 + Name string `json:"name"` 26 + ID string `json:"id"` 27 + MBID *string `json:"mbid,omitempty"` 28 28 }
+5 -5
service/lastfm/lastfm.go
··· 418 418 for _, a := range track.Artist { 419 419 artist := &teal.AlphaFeedDefs_Artist{ 420 420 ArtistName: a.Name, 421 - ArtistMbId: &a.MBID, 421 + ArtistMbId: a.MBID, 422 422 } 423 423 artists = append(artists, artist) 424 424 } ··· 444 444 // should be unix timestamp 445 445 PlayedTime: &playedTimeStr, // Pointer required 446 446 Artists: artists, 447 - ReleaseMbId: &track.ReleaseMBID, // Pointer required 448 - ReleaseName: &track.Album, // Pointer required 449 - RecordingMbId: &track.RecordingMBID, // Pointer required 450 - SubmissionClientAgent: &submissionAgent, // Pointer required 447 + ReleaseMbId: track.ReleaseMBID, // Pointer required 448 + ReleaseName: &track.Album, // Pointer required 449 + RecordingMbId: track.RecordingMBID, // Pointer required 450 + SubmissionClientAgent: &submissionAgent, // Pointer required 451 451 } 452 452 453 453 input := atproto.RepoCreateRecord_Input{
+3 -3
service/musicbrainz/musicbrainz.go
··· 296 296 artists[i] = models.Artist{ 297 297 Name: a.Name, 298 298 ID: a.Artist.ID, 299 - MBID: a.Artist.ID, 299 + MBID: &a.Artist.ID, 300 300 } 301 301 } 302 302 ··· 306 306 Name: track.Name, 307 307 URL: track.URL, 308 308 ServiceBaseUrl: track.ServiceBaseUrl, 309 - RecordingMBID: firstResult.ID, 309 + RecordingMBID: &firstResult.ID, 310 310 Album: firstResultAlbum.Title, 311 - ReleaseMBID: firstResultAlbum.ID, 311 + ReleaseMBID: &firstResultAlbum.ID, 312 312 ISRC: bestISRC, 313 313 Timestamp: track.Timestamp, 314 314 ProgressMs: track.ProgressMs,
+3 -3
service/spotify/spotify.go
··· 72 72 for _, a := range track.Artist { 73 73 artist := &teal.AlphaFeedDefs_Artist{ 74 74 ArtistName: a.Name, 75 - ArtistMbId: &a.MBID, 75 + ArtistMbId: a.MBID, 76 76 } 77 77 artists = append(artists, artist) 78 78 } ··· 101 101 TrackName: track.Name, 102 102 PlayedTime: &playedTimeStr, 103 103 Artists: artists, 104 - ReleaseMbId: &track.ReleaseMBID, 104 + ReleaseMbId: track.ReleaseMBID, 105 105 ReleaseName: &track.Album, 106 - RecordingMbId: &track.RecordingMBID, 106 + RecordingMbId: track.RecordingMBID, 107 107 // Optional: Spotify specific data if your lexicon supports it 108 108 // SpotifyTrackID: &track.ServiceID, 109 109 // SpotifyAlbumID: &track.ServiceAlbumID,