您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sp_error_message函数代码示例

51自学网 2021-06-03 08:08:07
  C++
这篇教程C++ sp_error_message函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sp_error_message函数的典型用法代码示例。如果您正苦于以下问题:C++ sp_error_message函数的具体用法?C++ sp_error_message怎么用?C++ sp_error_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sp_error_message函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: logged_in

/** * This callback is called when an attempt to login has succeeded or failed. * * @sa sp_session_callbacks#logged_in */static void logged_in(sp_session *sess, sp_error error){	sp_playlistcontainer *pc = sp_session_playlistcontainer(sess);	int i;	if (SP_ERROR_OK != error) {		fprintf(stderr, "jukebox: Login failed: %s/n",			sp_error_message(error));		exit(2);	}	sp_playlistcontainer_add_callbacks(		sp_session_playlistcontainer(g_sess),		&pc_callbacks,		NULL);	printf("jukebox: Looking at %d playlists/n", sp_playlistcontainer_num_playlists(pc));	for (i = 0; i < sp_playlistcontainer_num_playlists(pc); ++i) {		sp_playlist *pl = sp_playlistcontainer_playlist(pc, i);		sp_playlist_add_callbacks(pl, &pl_callbacks, NULL);		if (!strcasecmp(sp_playlist_name(pl), g_listname)) {			g_jukeboxlist = pl;			try_jukebox_start();		}	}	if (!g_jukeboxlist) {		printf("jukebox: No such playlist. Waiting for one to pop up.../n");		fflush(stdout);	}}
开发者ID:joseulisesmena,项目名称:technic,代码行数:39,


示例2: spotify_login

static gboolean spotify_login (GstSpotSrc *spot){  sp_error error;  if (GST_SPOT_SRC_LOGGED_IN (spot)) {    GST_DEBUG_OBJECT (spot, "Already logged in");    return TRUE;  }  GST_DEBUG_OBJECT (spot, "Trying to login");  /* login using the credentials given on the command line */  error = sp_session_login (GST_SPOT_SRC_SPOTIFY_SESSION (spot), GST_SPOT_SRC_USER (spot), GST_SPOT_SRC_PASS (spot));  if (SP_ERROR_OK != error) {    GST_ERROR_OBJECT (spot, "Failed to login: %s", sp_error_message (error));    return FALSE;  }  int timeout = -1;  sp_session_process_events (GST_SPOT_SRC_SPOTIFY_SESSION (spot), &timeout);  while (!GST_SPOT_SRC_LOGGED_IN (spot)) {    usleep (10000);    sp_session_process_events (GST_SPOT_SRC_SPOTIFY_SESSION (spot), &timeout);  }  GST_DEBUG_OBJECT (spot, "Login ok!"); return TRUE;}
开发者ID:popdevelop,项目名称:dogvibes_old,代码行数:30,


示例3: sp_session_player_load

 bool Codec::loadPlayer() {   Logger::printOut("load player");   if (!m_isPlayerLoaded) {     //do we have a track at all?     if (m_currentTrack) {       CStdString name;       Logger::printOut("load player 2");       if (sp_track_is_loaded(m_currentTrack)) {         sp_error error = sp_session_player_load(getSession(), m_currentTrack);         CStdString message;         Logger::printOut("load player 3");         message.Format("%s", sp_error_message(error));         Logger::printOut(message);         Logger::printOut("load player 4");         if (SP_ERROR_OK == error) {           sp_session_player_play(getSession(), true);           m_isPlayerLoaded = true;           Logger::printOut("load player 5");           return true;         }       }     } else       return false;   }   return true; }
开发者ID:TENFIRE,项目名称:spotyxbmc2,代码行数:26,


示例4: openspotify_init

/* * Initialize the Spotify session object, called by openspotify_thread() * */static int openspotify_init(void) {	sp_session_config config;	sp_error error;	sp_session_callbacks callbacks = {		&logged_in,		&logged_out,		&metadata_updated,		&connection_error,		NULL,		&notify_main_thread,		NULL,		NULL,		&log_message	};	memset(&config, 0, sizeof(config));	config.api_version = SPOTIFY_API_VERSION;	config.cache_location = "tmp";	config.settings_location = "tmp";	config.application_key = g_appkey;	config.application_key_size = g_appkey_size;	config.user_agent = "ml_openspotify";	config.callbacks = &callbacks;	error = sp_session_init(&config, &session);	if(error != SP_ERROR_OK) {		DSFYDEBUG("sp_session_init() failed with error '%s'/n", sp_error_message(error));		return -1;	}	return 0;}
开发者ID:Kitof,项目名称:openspotify,代码行数:39,


示例5: logged_in_callback

//// -- Spotify callbacks ---------------------------------------------------------------------------//static void logged_in_callback(sp_session *session, sp_error error) {    TRACE("logged_in_callback/n");    struct owl_state* state = sp_session_userdata(session);    if(error == SP_ERROR_OK) {        state->state = OWL_STATE_IDLE;        INFO("Logged in to Spotify!/n");        respond_success(state->http_request);    }    else {        state->state = OWL_STATE_INITIALIZED;        ERROR("Failed to login to Spotify: %s/n", sp_error_message(error));        respond_error(state->http_request, OWL_HTTP_ERROR_LOGIN, sp_error_message(error));    }}
开发者ID:eliasson,项目名称:owl,代码行数:19,


示例6: logged_in

/* * Callback that will be called by Spotify with result from login */static void logged_in(sp_session *sess, sp_error error) {  if (SP_ERROR_OK != error) {    printf("logged_in - Unable to login: %s/n", sp_error_message(error));  } else {  	g_logged_in = 1;    printf("logged_in - Success!/n");  }}
开发者ID:SepticInsect,项目名称:ScreamingEleanorII,代码行数:11,


示例7: sp_session_logout

void Spotify::logout(){    sp_error err = sp_session_logout(sp);    if (err != SP_ERROR_OK) {        qDebug() << "Unable to logout:" << QString::fromLocal8Bit(sp_error_message(err));    } else {        qDebug() << "Logout request posted";    }}
开发者ID:Risca,项目名称:roleplaying-music-control,代码行数:9,


示例8: PyErr_SetString

PyObject *handle_error(int err) {    if(err != 0) {        PyErr_SetString(SpotifyError, sp_error_message(err));        return NULL;    } else {        Py_INCREF(Py_None);        return Py_None;    }}
开发者ID:rektide,项目名称:pyspotify,代码行数:9,


示例9: printf

void *start_spotify(void *arg){  printf("Spotify: Started/n");  int next_timeout = 0;  sp_error err;  /* Create session */  session_config.application_key_size = g_appkey_size;  err = sp_session_create(&session_config, &session);  if(err != SP_ERROR_OK) {    fprintf(stderr, "Unable to create session: %s/n",            sp_error_message(err));    return NULL;  }  sp_session_login(session, username, password, 1);  for (;;) {    if (next_timeout == 0) {      while(!g_notify_do && !g_playback_done)        pthread_cond_wait(&g_notify_cond, &g_notify_mutex);    } else {      struct timespec ts;#if _POSIX_TIMERS > 0      clock_gettime(CLOCK_REALTIME, &ts);#else      struct timeval tv;      gettimeofday(&tv, NULL);      TIMEVAL_TO_TIMESPEC(&tv, &ts);#endif      ts.tv_sec += next_timeout / 1000;      ts.tv_nsec += (next_timeout % 1000) * 1000000;      pthread_cond_timedwait(&g_notify_cond, &g_notify_mutex, &ts);    }    g_notify_do = 0;    pthread_mutex_unlock(&g_notify_mutex);    if (g_playback_done) {      //      track_ended();      g_playback_done = 0;    }    do {      sp_session_process_events(session, &next_timeout);    } while (next_timeout == 0);    pthread_mutex_lock(&g_notify_mutex);  }}
开发者ID:andreasjansson,项目名称:Spotifilesystem,代码行数:56,


示例10: memset

/** * We'll spawn off a new thread which will be the 'spotify main thread' */static void *spotify_init_thread(void *arg){    gazify_t *gazify = (gazify_t *)arg;    sp_session_config config;	sp_error error;	sp_session *session;        /// The application key is specific to each project, and allows Spotify    /// to produce statistics on how our service is used.	extern const char g_appkey[];    /// The size of the application key.	extern const size_t g_appkey_size;    	memset(&config, 0, sizeof(config));    	// Always do this. It allows libspotify to check for	// header/library inconsistencies.	config.api_version = SPOTIFY_API_VERSION;    	// The path of the directory to store the cache. This must be specified.	// Please read the documentation on preferred values.	config.cache_location = "tmp";    	// The path of the directory to store the settings. 	// This must be specified.	// Please read the documentation on preferred values.	config.settings_location = "tmp";    	// The key of the application. They are generated by Spotify,	// and are specific to each application using libspotify.	config.application_key = g_appkey;	config.application_key_size = g_appkey_size;    	// This identifies the application using some	// free-text string [1, 255] characters.	config.user_agent = "Gazeify";    	// Register the callbacks.	config.callbacks = &callbacks;            audio_init(&g_audiofifo);	error = sp_session_create(&config, &session);	if (SP_ERROR_OK != error) {		fprintf(stderr, "failed to create session: %s/n",                sp_error_message(error));		return (void*)2;	}    gazify->session = session;    	// Login using the credentials given on the command line.	sp_session_login(session, gazify->username, gazify->password);        spotify_loop(arg);    return NULL;}
开发者ID:phb,项目名称:GSxSW-hackday,代码行数:59,


示例11: createTrackFromUri

int createTrackFromUri( char *uri , char *name ){    TRACE_2( PLAYERMANAGER , "createTrackFromUri( %s , __track__ )" , uri );    sp_link *link;    sp_error error;    if( playing == FALSE && hasNextTrack() == FALSE )        createFile( name );    TRACE_1( PLAYERMANAGER , "Creating URI : %s" , uri );    link = sp_link_create_from_string( uri );    if( link == NULL )    {        TRACE_ERROR( PLAYERMANAGER , "Fail to create link.");        return PC_ERROR;    }    else    {        TRACE_1( PLAYERMANAGER , "Success to create link.");    }    TRACE_3( PLAYERMANAGER , "Construct track...");    currentTrack = sp_link_as_track( link );    if( currentTrack == NULL )    {        TRACE_ERROR( PLAYERMANAGER , "Fail to create track.");        return PC_ERROR;    }    else    {        TRACE_1( PLAYERMANAGER , "Success to create track.");    }    error = sp_track_add_ref( currentTrack );    if( error != SP_ERROR_OK )    {        TRACE_ERROR( PLAYERMANAGER , "Cannot add ref track, reason: %s" , sp_error_message( error ) );        return PC_ERROR;    }    sp_link_release( link );    running = TRUE;//    playing = FALSE;    return PC_SUCCESS;}
开发者ID:raphui,项目名称:wMusic,代码行数:56,


示例12: on_logged_in

void on_logged_in(list<int> int_params, list<string> string_params, sp_session *session, sp_track *track) {	sp_error error = (sp_error)int_params.front();	bool success = (SP_ERROR_OK == error) ? true : false;	JNIEnv *env;	jclass class_libspotify = find_class_from_native_thread(&env);	jmethodID methodId = env->GetStaticMethodID(class_libspotify, "onLogin", "(ZLjava/lang/String;Ljava/lang/String;)V");	log("on_logged_in: success:%s, error %s, sp_error_message(error) %s, session %s, sp_session_user_name(session) %s",	    success?"true":"false", error==0?"null":"not null", sp_error_message(error)==0?"null":"not null",	    session==0?"null":"not null", sp_session_user_name(session)==0?"null":"not null");	env->CallStaticVoidMethod(class_libspotify, methodId, success, env->NewStringUTF(sp_error_message(error)),	    env->NewStringUTF(sp_session_user_name(session)));    if (env->ExceptionCheck()) {        env->ExceptionDescribe();        env->ExceptionClear();    }	env->DeleteLocalRef(class_libspotify);}
开发者ID:jarey,项目名称:tomahawk-android,代码行数:19,


示例13: on_login

static void on_login(sp_session *session, sp_error error){	debug("callback: on_login");	if (error != SP_ERROR_OK) {		fprintf(stderr, "Login failed: %s/n", sp_error_message(error));		exit(2);	}	g_logged_in = 1;}
开发者ID:delrtye,项目名称:Spot,代码行数:10,


示例14: qDebug

/**  loggedin  callback from spotify  also initilizes the playlistcontainer and callbacks  **/void SpotifySession::loggedIn(sp_session *session, sp_error error){   SpotifySession* _session = reinterpret_cast<SpotifySession*>(sp_session_userdata(session));    if (error == SP_ERROR_OK) {        qDebug() << "Logged in successfully!!";        _session->setSession(session);        _session->setLoggedIn(true);        _session->setPlaylistContainer( sp_session_playlistcontainer(session) );        sp_playlistcontainer_add_ref( _session->PlaylistContainer() );        sp_playlistcontainer_add_callbacks(_session->PlaylistContainer(), &SpotifyCallbacks::containerCallbacks, _session);    }    qDebug() << Q_FUNC_INFO << "==== " << sp_error_message( error ) << " ====";    const QString msg = QString::fromUtf8( sp_error_message( error ) );    emit _session->loginResponse( error == SP_ERROR_OK, msg );}
开发者ID:RedRudeBoy,项目名称:tomahawk-resolvers,代码行数:24,


示例15: logged_in

static void logged_in(sp_session *session, sp_error error){	(void)session;	if (error != SP_ERROR_OK) {		fprintf(stderr, "error while logging in %s/n",				sp_error_message(error));	}	printf("Logged in!/n");	fflush(stdout);}
开发者ID:iceaway,项目名称:libspotify-client,代码行数:10,


示例16: create_session

static sp_session *create_session(PyObject *client, PyObject *settings){    sp_session_config config;    sp_session* session;    sp_error error;    memset(&config, 0, sizeof(config));    config.api_version = SPOTIFY_API_VERSION;    config.userdata = (void*)client;    config.callbacks = &g_callbacks;    config.cache_location = "";    config.user_agent = "pyspotify-fallback";    config_data(settings, "application_key", &config.application_key, &config.application_key_size);    config_string(settings, "cache_location", &config.cache_location);    config_string(settings, "settings_location", &config.settings_location);    config_string(settings, "user_agent", &config.user_agent);    config_string(client, "proxy", &config.proxy);    config_string(client, "proxy_username", &config.proxy_username);    config_string(client, "proxy_password", &config.proxy_password);    debug_printf("cache_location = %s", config.cache_location);    debug_printf("settings_location = %s", config.settings_location);    debug_printf("user_agent = %s", config.user_agent);    debug_printf("proxy = %s", config.proxy);    debug_printf("proxy_username = %s", config.proxy_username);    debug_printf("proxy_password = %s", config.proxy_password);    debug_printf("application_key_size = %zu", config.application_key_size);    if (PyErr_Occurred() != NULL) {        return NULL;    }    if (strlen(config.user_agent) > 255) {        PyErr_SetString(SpotifyError, "user_agent may not be longer than 255.");        return NULL;    }    if (config.application_key_size == 0) {        PyErr_SetString(SpotifyError, "application_key must be provided.");        return NULL;    }    debug_printf("creating session...");    /* TODO: Figure out if we should ever release the session */    error = sp_session_create(&config, &session);    if (error != SP_ERROR_OK) {        PyErr_SetString(SpotifyError, sp_error_message(error));        return NULL;    }    session_constructed = 1;    g_session = session;    return session;}
开发者ID:ZenithDK,项目名称:pyspotify,代码行数:55,


示例17: search_complete

/** * Callback for libspotify * * @param browse    The browse result object that is now done * @param userdata  The opaque pointer given to sp_artistbrowse_create() */static void search_complete(sp_search *search, void *userdata){  if (sp_search_error(search) == SP_ERROR_OK)    print_search(search);  else    fprintf(stderr, "Failed to search: %s/n",            sp_error_message(sp_search_error(search)));  sp_search_release(search);  cmd_done();}
开发者ID:alsuren,项目名称:spotigit,代码行数:17,


示例18: browse_artist_callback

/** * Callback for libspotify * * @param browse    The browse result object that is now done * @param userdata  The opaque pointer given to sp_artistbrowse_create() */static void browse_artist_callback(sp_artistbrowse *browse, void *userdata){	if (sp_artistbrowse_error(browse) == SP_ERROR_OK)		print_artistbrowse(browse);	else		fprintf(stderr, "Failed to browse artist: %s/n",		        sp_error_message(sp_artistbrowse_error(browse)));	sp_artistbrowse_release(browse);	cmd_done();}
开发者ID:SoylentGraham,项目名称:Tootle,代码行数:17,


示例19: session_ready

/** * For the session test, we simply log out as soon as we are logged in. */void session_ready(sp_session *session){	sp_error error = sp_session_logout(session);	if (SP_ERROR_OK != error) {		fprintf(stderr, "failed to log out from Spotify: %s/n",		                sp_error_message(error));		g_exit_code = 5;		return;	}}
开发者ID:Kitof,项目名称:openspotify,代码行数:14,


示例20: handle_error

PyObject *handle_error(int err){    if (err != 0) {        PyErr_SetString(SpotifyError, sp_error_message(err));        return NULL;    }    else {        Py_RETURN_NONE;    }}
开发者ID:JoeConyers,项目名称:SpotifyRemote,代码行数:11,


示例21: on_logged_in

void on_logged_in(list<int> int_params, list<string> string_params, sp_session *session, sp_track *track) {	sp_error error = (sp_error)int_params.front();	bool success = (SP_ERROR_OK == error) ? true : false;	JNIEnv *env;	jclass class_libspotify = find_class_from_native_thread(&env);	jmethodID methodId = env->GetStaticMethodID(class_libspotify, "onLogin", "(ZLjava/lang/String;)V");	env->CallStaticVoidMethod(class_libspotify, methodId, success, env->NewStringUTF(sp_error_message(error)));	env->DeleteLocalRef(class_libspotify);}
开发者ID:GuacoIV,项目名称:VisEQ,代码行数:11,


示例22: logged_in

static void  SP_CALLCONV logged_in(sp_session *session, sp_error error) {	DSFYDEBUG("SESSION CALLBACK/n");	if (SP_ERROR_OK != error) {		fprintf(stderr, "failed to log in to Spotify: %s/n",		                sp_error_message(error));		g_exit_code = 4;		return;	}	DSFYDEBUG("Running session_ready()/n");	session_ready(session);}
开发者ID:Kitof,项目名称:openspotify,代码行数:12,


示例23: session_release

int session_release(void){	sp_error error;	error = sp_session_release(g_session);	if (error != SP_ERROR_OK) {		fprintf(stderr, "failed to release session: %s/n",				sp_error_message(error));		return -1;	}	return 0;}
开发者ID:iceaway,项目名称:libspotify-client,代码行数:13,


示例24: connection_error

static voidconnection_error(sp_session * session, sp_error error){    debug_printf(">> connection_error called: %s", sp_error_message(error));    PyGILState_STATE gstate = PyGILState_Ensure();    PyObject *py_error = error_message(error);    if (py_error != NULL) {        session_callback(session, "connection_error", py_error);        Py_DECREF(py_error);    }    PyGILState_Release(gstate);}
开发者ID:ZenithDK,项目名称:pyspotify,代码行数:13,


示例25: search_complete

static void search_complete(sp_search *search, void *userdata){        if (sp_search_error(search) == SP_ERROR_OK){             get_search(search);        }        else cmd_sendresponse(put_error(400, sp_error_message(sp_search_error(search))), 400);        sp_search_release(search);        cmd_done();}
开发者ID:dschmidt,项目名称:spotifyWebApi,代码行数:13,


示例26: sp_playlistcontainer_add_callbacks

void Spotify::loggedInCb(sp_session *sp, sp_error err){    if (err == SP_ERROR_OK) {        sp_playlistcontainer_add_callbacks(sp_session_playlistcontainer(sp),                                           Spotify_Wrapper::playlistcontainerCallbacks(),                                           this);        eq.put(EVENT_LOGGED_IN);    } else {        fprintf(stderr, "Failed to login: %s/n",                sp_error_message(err));        eq.put(EVENT_LOGGED_OUT);    }}
开发者ID:Risca,项目名称:roleplaying-music-control,代码行数:13,


示例27: session_logout

int session_logout(void){	sp_error error;	int retval = 0;	if (session_is_logged_in()) {		error = sp_session_logout(g_session);		if (error != SP_ERROR_OK) {			fprintf(stderr, "failed to log out %s/n",					sp_error_message(error));			retval = -1;		}	}	return retval;}
开发者ID:iceaway,项目名称:libspotify-client,代码行数:14,


示例28: main

int main(){	struct mg_server *server = mg_create_server(NULL, event_handler);	mg_set_option(server, "Partyfy", ".");	mg_set_option(server, "listening_port", "8080");	const char *username = "cs283project";    //size_t size;	char *password = getpass("Enter the password for the account/n");	sp_session *sp;	spconfig.application_key_size = g_appkey_size;	sp_error err = sp_session_create(&spconfig, &sp);	if(SP_ERROR_OK != err) {		fprintf(stderr, "Unable to create session: %s/n",				sp_error_message(err));		exit(1);	}	g_sess = sp;	pthread_mutex_init(&g_notify_mutex, NULL);	pthread_cond_init(&g_notify_cond, NULL);	sp_session_login(g_sess, username, password, 0, NULL);        // See if the user logged in successfully    printConnectionState();    int timeout = 0;    sp_connectionstate state = sp_session_connectionstate(g_sess);    while (state != SP_CONNECTION_STATE_LOGGED_IN) {		sp_session_process_events(g_sess, &timeout);	   	printf("Logging in.../n");        usleep(100000);        state = sp_session_connectionstate(g_sess);    }	//audio_init(&g_audiofifo);	printf("Logged in/n");    for(;;) {		mg_poll_server(server, 1000);		sp_session_process_events(g_sess, &timeout);		//while(!g_notify_do)		//	pthread_cond_wait(&g_notify_cond, &g_notify_mutex);		//g_notify_do = 0;		//pthread_mutex_unlock(&g_notify_mutex);		//if(g_playback_done) {		//	g_playback_done = 0;		//}		//pthread_mutex_lock(&g_notify_mutex);	}	mg_destroy_server(&server);}
开发者ID:tessmichi,项目名称:Partyfy,代码行数:50,


示例29: logged_in

static void logged_in(sp_session *session, sp_error error){	spotify_object *p = sp_session_userdata(session);	p->is_logged_in = 1;	if (SP_ERROR_OK != error) {		p->is_logged_out = 1;		sp_session_release(session);		char *errMsg;		spprintf(&errMsg, 0, "login failed: %s", sp_error_message(error));		zend_throw_exception((zend_class_entry*)zend_exception_get_default(), errMsg, 0 TSRMLS_CC);	}}
开发者ID:GazNicoll,项目名称:libspotify-php,代码行数:14,



注:本文中的sp_error_message函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sp_ftoc函数代码示例
C++ sp_env函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。