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 }
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 }