• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ sp_error_message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了sp_error_message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:jukebox.c


示例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,代码来源:gstspotsrc.c


示例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,代码来源:Codec.cpp


示例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,代码来源:openspotify.cpp


示例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,代码来源:owl.c


示例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,代码来源:session.c


示例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,代码来源:spotify.cpp


示例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,代码来源:session.c


示例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,代码来源:spfs.c


示例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,代码来源:spotify.cpp


示例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,代码来源:player.c


示例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,代码来源:tasks.cpp


示例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,代码来源:main.c


示例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,代码来源:spotifysession.cpp


示例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,代码来源:session.c


示例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,代码来源:session.c


示例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,代码来源:search.c


示例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,代码来源:browse.c


示例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,代码来源:session_ready.c


示例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,代码来源:session.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sp_ftoc函数代码示例发布时间:2022-05-30
下一篇:
C++ sp_env函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap