當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Playlist.Tracks方法代碼示例

本文整理匯總了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)
	}
}
開發者ID:rdbrdd,項目名稱:sconsify,代碼行數:9,代碼來源:cui.go

示例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()))
		}
	}
}
開發者ID:rdbrdd,項目名稱:sconsify,代碼行數:24,代碼來源:spotify_playlists.go

示例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()))
	}
}
開發者ID:KoehlerClem,項目名稱:sconsify,代碼行數:11,代碼來源:spotify_playlists.go


注:本文中的github.com/fabiofalci/sconsify/sconsify.Playlist.Tracks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。