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