本文整理汇总了C++中metadb_handle_ptr::get_subsong_index方法的典型用法代码示例。如果您正苦于以下问题:C++ metadb_handle_ptr::get_subsong_index方法的具体用法?C++ metadb_handle_ptr::get_subsong_index怎么用?C++ metadb_handle_ptr::get_subsong_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类metadb_handle_ptr
的用法示例。
在下文中一共展示了metadb_handle_ptr::get_subsong_index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSavePath
std::wstring LyricSourceLRC::getSavePath(const metadb_handle_ptr &track)
{
std::string path = track->get_path();
std::wstring wpath = EncodingFunc::ToUTF16(path.substr(boost::find_last(path, "://").end() - path.begin()));
wpath = wpath.substr(0, wpath.find_last_of(L"."));
if(track->get_subsong_index() != 0)
wpath += boost::lexical_cast<std::wstring>(track->get_subsong_index());
wpath += L".lrc";
if(m_config["lrcsavepath"].length())
{
class LRCTitleFormatCallback : public main_thread_callback
{
private:
HANDLE m_event;
std::string *m_out;
const std::string &m_format;
const metadb_handle_ptr &m_track;
public:
LRCTitleFormatCallback(HANDLE event, std::string *out, const std::string &format, const metadb_handle_ptr &track) : m_event(event), m_format(format), m_out(out), m_track(track) {}
virtual void callback_run()
{
core_api::ensure_main_thread();
pfc::string8 out;
service_ptr_t<titleformat_object> script;
static_api_ptr_t<titleformat_compiler>()->compile(script, m_format.c_str());
m_track->format_title(NULL, out, script, NULL);
m_out->assign(out.get_ptr());
SetEvent(m_event);
}
};
std::wstring dirname = wpath.substr(0, wpath.find_last_of(L'\\') + 1);
std::wstring filename = wpath.substr(wpath.find_last_of(L"\\") + 1);
HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL);
std::string out;
std::string pathtmp = m_config["lrcsavepath"];
if(pathtmp.at(pathtmp.length() - 1) != '\\')
pathtmp += '\\';
service_ptr_t<LRCTitleFormatCallback> p_callback = new service_impl_t<LRCTitleFormatCallback>(event, &out, pathtmp, track);
static_api_ptr_t<main_thread_callback_manager>()->add_callback(p_callback);
p_callback.release();
WaitForSingleObject(event, INFINITE);
CloseHandle(event);
wpath = EncodingFunc::ToUTF16(out);
if(PathIsRelative(wpath.c_str()))
wpath = dirname + wpath;
if(GetFileAttributes(wpath.c_str()) & FILE_ATTRIBUTE_DIRECTORY && (GetLastError() != ERROR_FILE_NOT_FOUND && GetLastError() != ERROR_PATH_NOT_FOUND))
wpath += filename;
return wpath;
}
if(path.find_first_of("file://") == std::string::npos)
return std::wstring(L"");
if(path.find_first_of("unpack://") == std::string::npos)
return std::wstring(L"");
return wpath;
}
示例2: handle_create_replace_path_canonical
void metadb::handle_create_replace_path_canonical(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path) {
handle_create(p_out,make_playable_location(p_new_path,p_source->get_subsong_index()));
}