本文整理汇总了C++中metadb_handle_ptr::get_async_info_ref方法的典型用法代码示例。如果您正苦于以下问题:C++ metadb_handle_ptr::get_async_info_ref方法的具体用法?C++ metadb_handle_ptr::get_async_info_ref怎么用?C++ metadb_handle_ptr::get_async_info_ref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类metadb_handle_ptr
的用法示例。
在下文中一共展示了metadb_handle_ptr::get_async_info_ref方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doesTrackHaveSimilarTitle
bool doesTrackHaveSimilarTitle(const std::string& title, const metadb_handle_ptr& track)
{
// todo: ignore slight differences, e.g. in punctuation
service_ptr_t<metadb_info_container> outInfo;
if (!track->get_async_info_ref(outInfo))
{
return false;
}
const file_info& fileInfo = outInfo->info();
if(!fileInfo.meta_exists("title"))
{
return false;
}
const std::string fileTitle = fileInfo.meta_get("title", 0);
if(stricmp_utf8(fileTitle.c_str(), title.c_str()) == 0)
{
return true;
}
else if(fileTitlesMatchExcludingBracketsOnLhs(fileTitle, title))
{
return true;
}
return false;
}
示例2: isTrackByArtist
inline bool isTrackByArtist(const std::string& artist, const metadb_handle_ptr& track)
{
// todo: ignore slight differences, e.g. in punctuation
service_ptr_t<metadb_info_container> outInfo;
if(track->get_async_info_ref(outInfo))
{
const file_info& fileInfo = outInfo->info();
for(t_size j = 0; j < fileInfo.meta_get_count_by_name("artist"); j++)
{
if(stricmp_utf8(fileInfo.meta_get("artist", j), artist.c_str()) == 0)
{
return true;
}
}
for(t_size j = 0; j < fileInfo.meta_get_count_by_name("album artist"); j++)
{
if(stricmp_utf8(fileInfo.meta_get("album artist", j), artist.c_str()) == 0)
{
return true;
}
}
}
return false;
}
示例3: getTitle
std::string getTitle(metadb_handle_ptr track)
{
service_ptr_t<metadb_info_container> outInfo;
if(!track->get_async_info_ref(outInfo))
{
return "";
}
const file_info& fileInfo = outInfo->info();
const bool has_title_tag = fileInfo.meta_exists("title");
if(!has_title_tag)
{
return "";
}
const char* title = fileInfo.meta_get("title", 0);
return title;
}
示例4: getArtist
std::string getArtist(metadb_handle_ptr track)
{
service_ptr_t<metadb_info_container> outInfo;
if(!track->get_async_info_ref(outInfo))
{
return "";
}
const file_info& fileInfo = outInfo->info();
const bool has_artist_tag = fileInfo.meta_exists("artist");
const bool has_album_artist_tag = fileInfo.meta_exists("album artist");
if(!(has_artist_tag || has_album_artist_tag))
{
return "";
}
const char* artistName = has_artist_tag ? fileInfo.meta_get("artist", 0) : fileInfo.meta_get("album artist", 0);
return artistName;
}
示例5: calculateTrackRating
float calculateTrackRating(const std::string& title, const metadb_handle_ptr& track)
{
service_ptr_t<metadb_info_container> outInfo;
if(!track->get_async_info_ref(outInfo))
{
// Don't pick it we can't get any info.
return -1.0f;
}
const file_info& fileInfo = outInfo->info();
if (!fileInfo.meta_exists("title"))
{
// Don't pick it if it doesn't have a title.
return -1.0f;
}
float totalRating = 0.0f;
const std::string fileTitle = fileInfo.meta_get("title", 0);
// Assume title is already roughly correct.
if(stricmp_utf8(fileTitle.c_str(), title.c_str()) == 0)
{
static const float ratingForExactTitleMatch = 2.0f;
totalRating += ratingForExactTitleMatch;
}
else
{
static const float ratingForTitleMatchWithBrackets = 1.0f;
totalRating += ratingForTitleMatchWithBrackets;
}
if(fileInfo.meta_exists("PLAY_COUNTER"))
{
const int playCount = atoi(fileInfo.meta_get("PLAY_COUNTER",0));
static const float lowPlayCount = 0.0f;
static const float highPlayCount = 10.0f;
static const float lowPlayCountRating = 0.0f;
static const float highPlayCountRating = 0.5f;
const float playCountRating = maths::map(static_cast<float>(playCount), lowPlayCount, highPlayCount, lowPlayCountRating, highPlayCountRating);
totalRating += playCountRating;
}
const auto bitrate = fileInfo.info_get_bitrate();
static const float lowBitrate = 0.0f;
static const float highBitrate = 1000.0f;
static const float lowBitrateRating = 0.0f;
static const float highBitrateRating = 2.0f;
const float bitrateRating = maths::map(static_cast<float>(bitrate), lowBitrate, highBitrate, lowBitrateRating, highBitrateRating);
totalRating += bitrateRating;
static const float releaseTypeWeighting = 3.0f;
float releaseTypeRating = 0.55f; // Default for if nothing is set; assume it's somewhere between a live album and a soundtrack.
if(fileInfo.meta_exists("musicbrainz album type") || fileInfo.meta_exists("releasetype"))
{
const std::string albumType = fileInfo.meta_exists("musicbrainz album type") ? fileInfo.meta_get("musicbrainz album type", 0) : fileInfo.meta_get("releasetype", 0);
if(albumType == "album")
{
releaseTypeRating = 1.0f;
}
else if(albumType == "single")
{
releaseTypeRating = 0.9f;
}
else if(albumType == "compilation")
{
releaseTypeRating = 0.8f;
}
else if(albumType == "ep")
{
releaseTypeRating = 0.7f;
}
else if(albumType == "soundtrack")
{
releaseTypeRating = 0.6f;
}
else if(albumType == "live")
{
releaseTypeRating = 0.5f;
}
else if(albumType == "other")
{
releaseTypeRating = 0.4f;
}
else if(albumType == "remix")
{
releaseTypeRating = 0.3f;
//.........这里部分代码省略.........