本文整理汇总了C++中CMusicInfoTag::GetLyrics方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::GetLyrics方法的具体用法?C++ CMusicInfoTag::GetLyrics怎么用?C++ CMusicInfoTag::GetLyrics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::GetLyrics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
CStdString path(pItem->m_strPath);
if (pItem->IsMusicDb())
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
CMusicInfoTag tag;
auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(path));
if (NULL != pLoader.get())
{
pLoader->Load(path, tag);
// then we set the fields from the file tags to the item
pItem->SetProperty("lyrics", tag.GetLyrics());
pItem->SetProperty("hasfullmusictag", "true");
return true;
}
return false;
}
示例2: 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;
}
示例3: LoadAdditionalTagInfo
bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem)
{
if (!pItem || (pItem->m_bIsFolder && !pItem->IsAudio()) ||
pItem->IsPlayList() || pItem->IsNFO() || pItem->IsInternetStream())
return false;
if (pItem->GetProperty("hasfullmusictag") == "true")
return false; // already have the information
std::string path(pItem->GetPath());
// For songs in library set the (primary) song artist and album properties
// Use song Id (not path) as called for items from either library or file view,
// but could also be listitem with tag loaded by a script
if (pItem->HasMusicInfoTag() &&
pItem->GetMusicInfoTag()->GetType() == MediaTypeSong &&
pItem->GetMusicInfoTag()->GetDatabaseId() > 0)
{
CMusicDatabase database;
database.Open();
// May already have song artist ids as item property set when data read from
// db, but check property is valid array (scripts could set item properties
// incorrectly), otherwise fetch artist using song id.
CArtist artist;
bool artistfound = false;
if (pItem->HasProperty("artistid") && pItem->GetProperty("artistid").isArray())
{
CVariant::const_iterator_array varid = pItem->GetProperty("artistid").begin_array();
int idArtist = varid->asInteger();
artistfound = database.GetArtist(idArtist, artist, false);
}
else
artistfound = database.GetArtistFromSong(pItem->GetMusicInfoTag()->GetDatabaseId(), artist);
if (artistfound)
CMusicDatabase::SetPropertiesFromArtist(*pItem, artist);
// May already have album id, otherwise fetch album from song id
CAlbum album;
bool albumfound = false;
int idAlbum = pItem->GetMusicInfoTag()->GetAlbumId();
if (idAlbum > 0)
albumfound = database.GetAlbum(idAlbum, album, false);
else
albumfound = database.GetAlbumFromSong(pItem->GetMusicInfoTag()->GetDatabaseId(), album);
if (albumfound)
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;
}