本文整理汇总了C++中addon::ScraperPtr::GetRelevance方法的典型用法代码示例。如果您正苦于以下问题:C++ ScraperPtr::GetRelevance方法的具体用法?C++ ScraperPtr::GetRelevance怎么用?C++ ScraperPtr::GetRelevance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addon::ScraperPtr
的用法示例。
在下文中一共展示了ScraperPtr::GetRelevance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DownloadAlbumInfo
//.........这里部分代码省略.........
if (m_bStop)
{
scraper.Cancel();
bCanceled = true;
}
Sleep(1);
}
}
CGUIDialogSelect *pDlg=NULL;
int iSelectedAlbum=0;
if (result == CNfoFile::NO_NFO)
{
iSelectedAlbum = -1; // set negative so that we can detect a failure
if (scraper.Succeeded() && scraper.GetAlbumCount() >= 1)
{
int bestMatch = -1;
double bestRelevance = 0;
double minRelevance = THRESHOLD;
if (scraper.GetAlbumCount() > 1) // score the matches
{
//show dialog with all albums found
if (pDialog)
{
pDlg = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDlg->SetHeading(g_localizeStrings.Get(181).c_str());
pDlg->Reset();
pDlg->EnableButton(true, 413); // manual
}
for (int i = 0; i < scraper.GetAlbumCount(); ++i)
{
CMusicAlbumInfo& info = scraper.GetAlbum(i);
double relevance = info.GetRelevance();
if (relevance < 0)
relevance = CUtil::AlbumRelevance(info.GetAlbum().strAlbum, strAlbum, StringUtils::Join(info.GetAlbum().artist, g_advancedSettings.m_musicItemSeparator), strArtist);
// if we're doing auto-selection (ie querying all albums at once, then allow 95->100% for perfect matches)
// otherwise, perfect matches only
if (relevance >= max(minRelevance, bestRelevance))
{ // we auto-select the best of these
bestRelevance = relevance;
bestMatch = i;
}
if (pDialog)
{
// set the label to [relevance] album - artist
CStdString strTemp;
strTemp.Format("[%0.2f] %s", relevance, info.GetTitle2());
CFileItem item(strTemp);
item.m_idepth = i; // use this to hold the index of the album in the scraper
pDlg->Add(&item);
}
if (relevance > .99f) // we're so close, no reason to search further
break;
}
}
else
{
CMusicAlbumInfo& info = scraper.GetAlbum(0);
double relevance = info.GetRelevance();
if (relevance < 0)
relevance = CUtil::AlbumRelevance(info.GetAlbum().strAlbum, strAlbum, StringUtils::Join(info.GetAlbum().artist, g_advancedSettings.m_musicItemSeparator), strArtist);
if (relevance < THRESHOLD)
{
m_musicDatabase.Close();
示例2: DownloadAlbumInfo
//.........这里部分代码省略.........
{
if (m_bStop)
{
scraper.Cancel();
return INFO_CANCELLED;
}
Sleep(1);
}
}
CGUIDialogSelect *pDlg = NULL;
int iSelectedAlbum=0;
if (result == CNfoFile::NO_NFO && !bMusicBrainz)
{
iSelectedAlbum = -1; // set negative so that we can detect a failure
if (scraper.Succeeded() && scraper.GetAlbumCount() >= 1)
{
double bestRelevance = 0;
double minRelevance = THRESHOLD;
if (scraper.GetAlbumCount() > 1) // score the matches
{
//show dialog with all albums found
if (pDialog)
{
pDlg = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDlg->SetHeading(g_localizeStrings.Get(181).c_str());
pDlg->Reset();
pDlg->EnableButton(true, 413); // manual
}
for (int i = 0; i < scraper.GetAlbumCount(); ++i)
{
CMusicAlbumInfo& info = scraper.GetAlbum(i);
double relevance = info.GetRelevance();
if (relevance < 0)
relevance = CUtil::AlbumRelevance(info.GetAlbum().strAlbum, album.strAlbum, StringUtils::Join(info.GetAlbum().artist, g_advancedSettings.m_musicItemSeparator), StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator));
// if we're doing auto-selection (ie querying all albums at once, then allow 95->100% for perfect matches)
// otherwise, perfect matches only
if (relevance >= max(minRelevance, bestRelevance))
{ // we auto-select the best of these
bestRelevance = relevance;
iSelectedAlbum = i;
}
if (pDialog)
{
// set the label to [relevance] album - artist
std::string strTemp = StringUtils::Format("[%0.2f] %s", relevance, info.GetTitle2().c_str());
CFileItem item(strTemp);
item.m_idepth = i; // use this to hold the index of the album in the scraper
pDlg->Add(&item);
}
if (relevance > .99f) // we're so close, no reason to search further
break;
}
if (pDialog && bestRelevance < THRESHOLD)
{
pDlg->Sort(false);
pDlg->DoModal();
// and wait till user selects one
if (pDlg->GetSelectedLabel() < 0)
{ // none chosen
if (!pDlg->IsButtonPressed())
return INFO_CANCELLED;