コード例 #1
0
ファイル: spotify.go プロジェクト: gitter-badger/sconsify
func (spotify *Spotify) initSession(pa *portAudio, cacheLocation string) error {
	var err error
	spotify.session, err = sp.NewSession(&sp.Config{
		ApplicationKey:   spotify.appKey,
		ApplicationName:  "sconsify",
		CacheLocation:    cacheLocation,
		SettingsLocation: cacheLocation,
		AudioConsumer:    pa,
	})

	return err
}
コード例 #2
0
ファイル: spotify.go プロジェクト: rdbrdd/sconsify
func (spotify *Spotify) initSession(pa *portAudio, cacheLocation string, preferredBitrate *string) error {
	var err error
	spotify.session, err = sp.NewSession(&sp.Config{
		ApplicationKey:   spotify.appKey,
		ApplicationName:  "sconsify",
		CacheLocation:    cacheLocation,
		SettingsLocation: cacheLocation,
		AudioConsumer:    pa,
	})

	switch *preferredBitrate {
	case "96k":
		spotify.session.PreferredBitrate(sp.Bitrate96k)
	case "160k":
		spotify.session.PreferredBitrate(sp.Bitrate160k)
	default:
		spotify.session.PreferredBitrate(sp.Bitrate320k)
	}

	return err
}