Beispiel #1
0
func initSessionConfig() *C.sp_session_config {

	sc := new(C.sp_session_config)
	sc.api_version = C.SPOTIFY_API_VERSION
	sc.cache_location = C.CString("tmp")
	sc.settings_location = C.CString("tmp")
	sc.application_key = ((unsafe.Pointer)(&C.g_appkey))
	sc.application_key_size = C.g_appkey_size
	sc.user_agent = C.CString("Spotify webserver")
	sc.callbacks = initSessionCallbacks()
	sc.userdata = nil
	sc.compress_playlists = 0
	sc.dont_save_metadata_for_playlists = 0
	sc.initially_unload_playlists = 0
	//sc.device_id = C.CString("72694876234987628791242")
	sc.proxy = nil
	sc.proxy_username = nil
	sc.proxy_password = nil
	sc.tracefile = nil
	return sc
}
Beispiel #2
0
func spotify_init() {
	var config C.sp_session_config
	var session *C.sp_session

	temp_location := C.CString("tmp")
	user_agent := C.CString("spotigo client")

	config.api_version = C.SPOTIFY_API_VERSION
	config.cache_location = temp_location
	config.settings_location = temp_location
	config.application_key = PointerTo(C.g_appkey_ptr)
	config.application_key_size = C.g_appkey_size
	config.user_agent = user_agent

	// Register the callbacks.
	config.callbacks = &session_callbacks

	err := C.sp_session_create(&config, &session)
	if C.SP_ERROR_OK != err {
		fmt.Println("sp_session_create error", err)
	} else {
		fmt.Println("got session")
	}
}