本文整理匯總了Golang中github.com/fabiofalci/sconsify/sconsify.Playlist.Tracks方法的典型用法代碼示例。如果您正苦於以下問題:Golang Playlist.Tracks方法的具體用法?Golang Playlist.Tracks怎麽用?Golang Playlist.Tracks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/fabiofalci/sconsify/sconsify.Playlist
的用法示例。
在下文中一共展示了Playlist.Tracks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ArtistTopTracks
func (cui *ConsoleUserInterface) ArtistTopTracks(playlist *sconsify.Playlist) {
gui.infoTopTracksView.Clear()
fmt.Fprintf(gui.infoTopTracksView, "Top Tracks\n")
for i := 0; i < playlist.Tracks(); i++ {
track := playlist.Track(i)
fmt.Fprintf(gui.infoTopTracksView, "%v. %v\n", (i + 1), track.Name)
}
}
示例2: loadSongs
func (spotify *Spotify) loadSongs(playlist *sconsify.Playlist, webApiCache *WebApiCache) {
var partialSongs []webspotify.SavedTrack
if spotify.client != nil {
if savedTrackPage, err := spotify.client.CurrentUsersTracksOpt(createWebSpotifyOptions(50, playlist.Tracks())); err == nil {
partialSongs = savedTrackPage.Tracks
if webApiCache.Songs == nil {
webApiCache.Songs = make([]webspotify.SavedTrack, 0)
}
webApiCache.Songs = append(webApiCache.Songs, partialSongs...)
}
}
if webApiCache.Songs != nil {
if partialSongs == nil {
partialSongs = webApiCache.Songs
}
for i, track := range partialSongs {
webApiCache.Songs[i] = track
webArtist := track.Artists[0]
artist := sconsify.InitArtist(string(webArtist.URI), webArtist.Name)
playlist.AddTrack(sconsify.InitWebApiTrack(string(track.URI), artist, track.Name, track.TimeDuration().String()))
}
}
}
示例3: loadSongs
func (spotify *Spotify) loadSongs(playlist *sconsify.Playlist) {
savedTrackPage, err := spotify.client.CurrentUsersTracksOpt(createWebSpotifyOptions(50, playlist.Tracks()))
if err != nil {
return
}
for _, track := range savedTrackPage.Tracks {
webArtist := track.Artists[0]
artist := sconsify.InitArtist(string(webArtist.URI), webArtist.Name)
playlist.AddTrack(sconsify.InitWebApiTrack(string(track.URI), artist, track.Name, track.TimeDuration().String()))
}
}