Fix Track model to match Python reference
- R128: changed from JSONR128 float64 to R128 struct with i, tp, important_secs fields (Python R128 is an object, not a number) - StorageID -> StorageDir with json tag storage_dir (Python API uses storage_dir) - Lyrics: replaced TrackLyricsInfo with Lyrics (from supplement/lyrics.py) and TrackLyricsInfo (from track/lyrics_info.py with has_available_sync_lyrics, has_available_text_lyrics fields) - Track.Lyrics field now maps to lyrics_info JSON key with TrackLyricsInfo type
This commit is contained in:
1 parent
ad83d84531
commit
6312c24b0f
5 files changed
+192
-52
No files matched your search
@@ -43,7 +43,7 @@ func TestTrack_DeJSON(t *testing.T) {
|
||||
"id": "123",
|
||||
"title": "Test Track",
|
||||
"duration_ms": 180000,
|
||||
"storage_id": "456",
|
||||
"storage_dir": "456",
|
||||
"cover_uri": "https://example.com/cover.jpg",
|
||||
"genre": "rock",
|
||||
"version": "album",
|
||||
@@ -55,7 +55,7 @@ func TestTrack_DeJSON(t *testing.T) {
|
||||
"artists": [{"id": "1", "name": "Artist 1", "cover_uri": "https://example.com/artist.jpg"}],
|
||||
"albums": [{"id": "789", "title": "Test Album", "cover_uri": "https://example.com/album.jpg", "year": 2023}],
|
||||
"major": {"id": "major1", "name": "Major Label", "description": "Big label"},
|
||||
"lyrics": {"id": "lyr1", "text": "Test lyrics", "available": true, "has_text": true}
|
||||
"lyrics_info": {"has_available_sync_lyrics": true, "has_available_text_lyrics": true}
|
||||
}`)
|
||||
|
||||
track := &Track{BaseModel: *NewBaseModel(client)}
|
||||
@@ -80,8 +80,8 @@ func TestTrack_DeJSON(t *testing.T) {
|
||||
if resultTrack.Major == nil || resultTrack.Major.Name != "Major Label" {
|
||||
t.Errorf("Expected Major 'Major Label'")
|
||||
}
|
||||
if resultTrack.Lyrics == nil || resultTrack.Lyrics.Text != "Test lyrics" {
|
||||
t.Errorf("Expected Lyrics 'Test lyrics'")
|
||||
if resultTrack.LyricsInfo == nil || resultTrack.LyricsInfo.HasAvailableSyncLyrics != true {
|
||||
t.Errorf("Expected LyricsInfo.HasAvailableSyncLyrics true")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user