本文整理汇总了C++中metadb_handle_ptr::get_info方法的典型用法代码示例。如果您正苦于以下问题:C++ metadb_handle_ptr::get_info方法的具体用法?C++ metadb_handle_ptr::get_info怎么用?C++ metadb_handle_ptr::get_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类metadb_handle_ptr
的用法示例。
在下文中一共展示了metadb_handle_ptr::get_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_playback_new_track
void on_playback_new_track(metadb_handle_ptr p_track) {
CURL *curl;
pfc::string8 authstr=cfg_username;
authstr+=":";
authstr+=cfg_password;
const char* URL="http://api.t.sina.com.cn/statuses/update.xml";
pfc::string8 req_data="source=483394858&lat=0&long=0&status=%e6%88%91%e6%ad%a3%e5%9c%a8%e5%90%ac ";
file_info_impl track_info;
if (p_track->get_info(track_info))
{
const char* track_artist = track_info.meta_get("artist", 0);
const char* track_title = track_info.meta_get("title", 0);
// const char* track_album = track_info.meta_get("album", 0);
//if (track_album == NULL)
// track_album = "";
if (track_artist == NULL)
{
track_artist="N/A ";
}
if (track_title != NULL)
{
/* req_data+="";
req_data+=track_album;
req_data+=" ";*/
req_data+=track_artist;
req_data+="--";
req_data+=track_title;
curl = curl_easy_init();
if(curl) {
//设置url
curl_easy_setopt(curl, CURLOPT_URL,URL);
//设置basic验证信息
const char* authdata=authstr;
curl_easy_setopt(curl,CURLOPT_USERPWD,authdata);
//设置post字段信息
const char* data=req_data;
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,data);
//设置回调函数
curl_easy_setopt(curl,CURLOPT_READFUNCTION,read_callback);
// popup_message::g_complain(authstr);
// popup_message::g_complain(req_data);
// popup_message::g_complain(URL);
//提交
CURLcode res =
curl_easy_perform(curl);
if (res != CURLE_OK)
{
//popup_message::g_complain("fail!");
console::printf( "failed to perform the request '%s' [%s]\n", URL,curl_easy_strerror(res));
}else{
//popup_message::g_complain("success!");
console::printf( "success to perform the request '%s' [%s]\n", URL,curl_easy_strerror(res));
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
return ;
}
}