Skip to content

Commit 4e91bcd

Browse files
committed
added duration field to track struct
1 parent ec98e34 commit 4e91bcd

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/discovery/listenbrainz.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ type Exploration struct {
7676
Tracks []struct {
7777
Album string `json:"album"`
7878
Creator string `json:"creator"`
79+
Duration int `json:"duration"`
7980
Extension struct {
8081
HTTPSMusicbrainzOrgDocJspfTrack struct {
8182
AddedAt time.Time `json:"added_at"`
@@ -208,6 +209,7 @@ func (c *ListenBrainz) getTracks(mbids []string, separator string, singleArtist
208209
CleanTitle: recording.Recording.Name,
209210
Title: title,
210211
File: getFilename(title, artist, separator),
212+
Duration: recording.Recording.Length,
211213
})
212214
}
213215

@@ -282,6 +284,7 @@ func (c *ListenBrainz) parseWeeklyExploration(identifier, separator string, sing
282284
CleanTitle: track.Title,
283285
Title: title,
284286
File: getFilename(title, artist, separator),
287+
Duration: track.Duration,
285288
})
286289
}
287290

src/models/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ type Track struct {
1111
Title string // Title as built in BuildTracks()
1212
File string // File name
1313
Present bool // is track present in the system or not
14+
Duration int // Track duration in milliseconds (not available for every track)
1415
}

0 commit comments

Comments
 (0)