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


Golang Playlist.AddPlaylist方法代碼示例

本文整理匯總了Golang中github.com/fabiofalci/sconsify/sconsify.Playlist.AddPlaylist方法的典型用法代碼示例。如果您正苦於以下問題:Golang Playlist.AddPlaylist方法的具體用法?Golang Playlist.AddPlaylist怎麽用?Golang Playlist.AddPlaylist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/fabiofalci/sconsify/sconsify.Playlist的用法示例。


在下文中一共展示了Playlist.AddPlaylist方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: loadNewReleases

func (spotify *Spotify) loadNewReleases(playlist *sconsify.Playlist, webApiCache *WebApiCache) {
	if spotify.client != nil {
		if _, simplePlaylistPage, err := spotify.client.FeaturedPlaylistsOpt(&webspotify.PlaylistOptions{Options: *createWebSpotifyOptions(50, playlist.Playlists())}); err == nil {
			webApiCache.NewReleases = make([]webspotify.FullPlaylist, len(simplePlaylistPage.Playlists))
			for i, webPlaylist := range simplePlaylistPage.Playlists {
				if fullPlaylist, err := spotify.client.GetPlaylist(webPlaylist.Owner.ID, webPlaylist.ID); err == nil {
					webApiCache.NewReleases[i] = *fullPlaylist
				}
			}
		}
	}

	if webApiCache.NewReleases != nil {
		for _, fullPlaylist := range webApiCache.NewReleases {
			tracks := make([]*sconsify.Track, len(fullPlaylist.Tracks.Tracks))
			for i, track := range fullPlaylist.Tracks.Tracks {
				webArtist := track.Track.Artists[0]
				artist := sconsify.InitArtist(string(webArtist.URI), webArtist.Name)
				tracks[i] = sconsify.InitWebApiTrack(string(track.Track.URI), artist, track.Track.Name, track.Track.TimeDuration().String())
			}
			playlist.AddPlaylist(sconsify.InitSubPlaylist(string(fullPlaylist.URI), fullPlaylist.Name, tracks))
		}
		playlist.OpenFolder()
	}
}
開發者ID:rdbrdd,項目名稱:sconsify,代碼行數:25,代碼來源:spotify_playlists.go

示例2: loadArtists

func (spotify *Spotify) loadArtists(playlist *sconsify.Playlist) {
	fullArtistCursorPage, err := spotify.client.CurrentUsersFollowedArtists()
	if err != nil {
		return
	}
	for _, fullArtist := range fullArtistCursorPage.Artists {
		tracks := make([]*sconsify.Track, 0)
		playlist.AddPlaylist(sconsify.InitSubPlaylist(string(fullArtist.ID), fullArtist.Name, tracks))
		playlist.OpenFolder()
	}
}
開發者ID:KoehlerClem,項目名稱:sconsify,代碼行數:11,代碼來源:spotify_playlists.go

示例3: loadAlbums

func (spotify *Spotify) loadAlbums(playlist *sconsify.Playlist) {
	savedAlbumPage, err := spotify.client.CurrentUsersAlbumsOpt(createWebSpotifyOptions(50, playlist.Playlists()))
	if err != nil {
		return
	}

	for _, album := range savedAlbumPage.Albums {
		tracks := make([]*sconsify.Track, len(album.Tracks.Tracks))
		for i, track := range album.Tracks.Tracks {
			webArtist := track.Artists[0]
			artist := sconsify.InitArtist(string(webArtist.URI), webArtist.Name)
			tracks[i] = sconsify.InitWebApiTrack(string(track.URI), artist, track.Name, track.TimeDuration().String())
		}
		playlist.AddPlaylist(sconsify.InitSubPlaylist(string(album.ID), album.Name, tracks))
	}
	playlist.OpenFolder()
}
開發者ID:KoehlerClem,項目名稱:sconsify,代碼行數:17,代碼來源:spotify_playlists.go

示例4: loadNewReleases

func (spotify *Spotify) loadNewReleases(playlist *sconsify.Playlist) {
	_, simplePlaylistPage, err := spotify.client.FeaturedPlaylistsOpt(&webspotify.PlaylistOptions{Options: *createWebSpotifyOptions(50, playlist.Playlists())})
	if err != nil {
		return
	}
	for _, album := range simplePlaylistPage.Playlists {
		fullPlaylist, err := spotify.client.GetPlaylist(album.Owner.ID, album.ID)
		if err == nil {
			tracks := make([]*sconsify.Track, len(fullPlaylist.Tracks.Tracks))
			for i, track := range fullPlaylist.Tracks.Tracks {
				webArtist := track.Track.Artists[0]
				artist := sconsify.InitArtist(string(webArtist.URI), webArtist.Name)
				tracks[i] = sconsify.InitWebApiTrack(string(track.Track.URI), artist, track.Track.Name, track.Track.TimeDuration().String())
			}
			playlist.AddPlaylist(sconsify.InitSubPlaylist(string(album.ID), album.Name, tracks))
		}
		playlist.OpenFolder()
	}
}
開發者ID:KoehlerClem,項目名稱:sconsify,代碼行數:19,代碼來源:spotify_playlists.go

示例5: loadAlbums

func (spotify *Spotify) loadAlbums(playlist *sconsify.Playlist, webApiCache *WebApiCache) {
	if spotify.client != nil {
		if savedAlbumPage, err := spotify.client.CurrentUsersAlbumsOpt(createWebSpotifyOptions(50, playlist.Playlists())); err == nil {
			webApiCache.Albums = savedAlbumPage.Albums
		}
	}

	if webApiCache.Albums != nil {
		for _, album := range webApiCache.Albums {
			tracks := make([]*sconsify.Track, len(album.Tracks.Tracks))
			for j, track := range album.Tracks.Tracks {
				webArtist := track.Artists[0]
				artist := sconsify.InitArtist(string(webArtist.URI), webArtist.Name)
				tracks[j] = sconsify.InitWebApiTrack(string(track.URI), artist, track.Name, track.TimeDuration().String())
			}
			playlist.AddPlaylist(sconsify.InitSubPlaylist(string(album.URI), album.Name, tracks))
		}
		playlist.OpenFolder()
	}

}
開發者ID:rdbrdd,項目名稱:sconsify,代碼行數:21,代碼來源:spotify_playlists.go


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