本文整理汇总了C++中xfile::musicdatabasedirectory::CQueryParams::GetAlbumId方法的典型用法代码示例。如果您正苦于以下问题:C++ CQueryParams::GetAlbumId方法的具体用法?C++ CQueryParams::GetAlbumId怎么用?C++ CQueryParams::GetAlbumId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xfile::musicdatabasedirectory::CQueryParams
的用法示例。
在下文中一共展示了CQueryParams::GetAlbumId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAdditionalTagInfo
bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem)
{
if (!pItem || pItem->m_bIsFolder || pItem->IsPlayList() || pItem->IsNFO() || pItem->IsInternetStream())
return false;
if (pItem->GetProperty("hasfullmusictag") == "true")
return false; // already have the information
std::string path(pItem->GetPath());
if (pItem->IsMusicDb())
{
// set the artist / album properties
XFILE::MUSICDATABASEDIRECTORY::CQueryParams param;
XFILE::MUSICDATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(pItem->GetPath(),param);
CArtist artist;
CMusicDatabase database;
database.Open();
if (database.GetArtist(param.GetArtistId(), artist, false))
CMusicDatabase::SetPropertiesFromArtist(*pItem,artist);
CAlbum album;
if (database.GetAlbum(param.GetAlbumId(), album, false))
CMusicDatabase::SetPropertiesFromAlbum(*pItem,album);
path = pItem->GetMusicInfoTag()->GetURL();
}
CLog::Log(LOGDEBUG, "Loading additional tag info for file %s", path.c_str());
// we load up the actual tag for this file in order to
// fetch the lyrics and add it to the current music info tag
CFileItem tempItem(path, false);
std::unique_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(tempItem));
if (NULL != pLoader.get())
{
CMusicInfoTag tag;
pLoader->Load(path, tag);
pItem->GetMusicInfoTag()->SetLyrics(tag.GetLyrics());
pItem->SetProperty("hasfullmusictag", "true");
return true;
}
return false;
}
示例2: DownloadAlbumInfo
bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdString& strArtist, const CStdString& strAlbum, bool& bCanceled, CMusicAlbumInfo& albumInfo, CGUIDialogProgress* pDialog)
{
CAlbum album;
VECSONGS songs;
XFILE::MUSICDATABASEDIRECTORY::CQueryParams params;
XFILE::MUSICDATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(strPath, params);
bCanceled = false;
m_musicDatabase.Open();
if (m_musicDatabase.HasAlbumInfo(params.GetAlbumId()) && m_musicDatabase.GetAlbumInfo(params.GetAlbumId(),album,&songs))
return true;
// find album info
ADDON::ScraperPtr info;
if (!m_musicDatabase.GetScraperForPath(strPath, info, ADDON::ADDON_SCRAPER_ALBUMS) || !info)
{
m_musicDatabase.Close();
return false;
}
if (m_handle)
{
m_handle->SetTitle(StringUtils::Format(g_localizeStrings.Get(20321), info->Name().c_str()));
m_handle->SetText(strArtist+" - "+strAlbum);
}
// clear our scraper cache
info->ClearCache();
CMusicInfoScraper scraper(info);
// handle nfo files
CStdString strAlbumPath, strNfo;
m_musicDatabase.GetAlbumPath(params.GetAlbumId(),strAlbumPath);
URIUtils::AddFileToFolder(strAlbumPath,"album.nfo",strNfo);
CNfoFile::NFOResult result=CNfoFile::NO_NFO;
CNfoFile nfoReader;
if (XFILE::CFile::Exists(strNfo))
{
CLog::Log(LOGDEBUG,"Found matching nfo file: %s", strNfo.c_str());
result = nfoReader.Create(strNfo, info, -1, strPath);
if (result == CNfoFile::FULL_NFO)
{
CLog::Log(LOGDEBUG, "%s Got details from nfo", __FUNCTION__);
CAlbum album;
nfoReader.GetDetails(album);
m_musicDatabase.SetAlbumInfo(params.GetAlbumId(), album, album.songs);
GetAlbumArtwork(params.GetAlbumId(), album);
m_musicDatabase.Close();
return true;
}
else if (result == CNfoFile::URL_NFO || result == CNfoFile::COMBINED_NFO)
{
CScraperUrl scrUrl(nfoReader.ScraperUrl());
CMusicAlbumInfo album("nfo",scrUrl);
info = nfoReader.GetScraperInfo();
CLog::Log(LOGDEBUG,"-- nfo-scraper: %s",info->Name().c_str());
CLog::Log(LOGDEBUG,"-- nfo url: %s", scrUrl.m_url[0].m_url.c_str());
scraper.SetScraperInfo(info);
scraper.GetAlbums().push_back(album);
}
else
CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
}
if (!scraper.CheckValidOrFallback(g_guiSettings.GetString("musiclibrary.albumsscraper")))
{ // the current scraper is invalid, as is the default - bail
CLog::Log(LOGERROR, "%s - current and default scrapers are invalid. Pick another one", __FUNCTION__);
return false;
}
if (!scraper.GetAlbumCount())
{
scraper.FindAlbumInfo(strAlbum, strArtist);
while (!scraper.Completed())
{
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)
{
//.........这里部分代码省略.........