本文整理汇总了C++中CMusicThumbLoader::OnLoaderStart方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicThumbLoader::OnLoaderStart方法的具体用法?C++ CMusicThumbLoader::OnLoaderStart怎么用?C++ CMusicThumbLoader::OnLoaderStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicThumbLoader
的用法示例。
在下文中一共展示了CMusicThumbLoader::OnLoaderStart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateMusic
bool CRecentlyAddedJob::UpdateMusic()
{
CGUIWindow* home = g_windowManager.GetWindow(WINDOW_HOME);
if ( home == NULL )
return false;
CLog::Log(LOGDEBUG, "CRecentlyAddedJob::UpdateMusic() - Running RecentlyAdded home screen update");
int i = 0;
CFileItemList musicItems;
CMusicDatabase musicdatabase;
CMusicThumbLoader loader;
loader.OnLoaderStart();
musicdatabase.Open();
if (musicdatabase.GetRecentlyAddedAlbumSongs(g_advancedSettings.m_recentlyAddedMusicPath, musicItems, NUM_ITEMS))
{
long idAlbum = -1;
std::string strAlbumThumb;
std::string strAlbumFanart;
for (; i < musicItems.Size(); ++i)
{
CFileItemPtr item = musicItems.Get(i);
std::string value = StringUtils::Format("%i", i + 1);
std::string strRating;
std::string strAlbum = item->GetMusicInfoTag()->GetAlbum();
std::string strArtist = item->GetMusicInfoTag()->GetArtistString();
if (idAlbum != item->GetMusicInfoTag()->GetAlbumId())
{
strAlbumThumb.clear();
strAlbumFanart.clear();
idAlbum = item->GetMusicInfoTag()->GetAlbumId();
if (loader.LoadItem(item.get()))
{
strAlbumThumb = item->GetArt("thumb");
strAlbumFanart = item->GetArt("fanart");
}
}
strRating = StringUtils::Format("%c", item->GetMusicInfoTag()->GetUserrating());
home->SetProperty("LatestSong." + value + ".Title" , item->GetMusicInfoTag()->GetTitle());
home->SetProperty("LatestSong." + value + ".Year" , item->GetMusicInfoTag()->GetYear());
home->SetProperty("LatestSong." + value + ".Artist" , strArtist);
home->SetProperty("LatestSong." + value + ".Album" , strAlbum);
home->SetProperty("LatestSong." + value + ".Rating" , strRating);
home->SetProperty("LatestSong." + value + ".Path" , item->GetMusicInfoTag()->GetURL());
home->SetProperty("LatestSong." + value + ".Thumb" , strAlbumThumb);
home->SetProperty("LatestSong." + value + ".Fanart" , strAlbumFanart);
}
}
for (; i < NUM_ITEMS; ++i)
{
std::string value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestSong." + value + ".Title" , "");
home->SetProperty("LatestSong." + value + ".Year" , "");
home->SetProperty("LatestSong." + value + ".Artist" , "");
home->SetProperty("LatestSong." + value + ".Album" , "");
home->SetProperty("LatestSong." + value + ".Rating" , "");
home->SetProperty("LatestSong." + value + ".Path" , "");
home->SetProperty("LatestSong." + value + ".Thumb" , "");
home->SetProperty("LatestSong." + value + ".Fanart" , "");
}
i = 0;
VECALBUMS albums;
if (musicdatabase.GetRecentlyAddedAlbums(albums, NUM_ITEMS))
{
for (; i < (int)albums.size(); ++i)
{
CAlbum& album=albums[i];
std::string value = StringUtils::Format("%i", i + 1);
std::string strThumb = musicdatabase.GetArtForItem(album.idAlbum, MediaTypeAlbum, "thumb");
std::string strFanart = musicdatabase.GetArtistArtForItem(album.idAlbum, MediaTypeAlbum, "fanart");
std::string strDBpath = StringUtils::Format("musicdb://albums/%li/", album.idAlbum);
home->SetProperty("LatestAlbum." + value + ".Title" , album.strAlbum);
home->SetProperty("LatestAlbum." + value + ".Year" , album.iYear);
home->SetProperty("LatestAlbum." + value + ".Artist" , album.GetAlbumArtistString());
home->SetProperty("LatestAlbum." + value + ".Rating" , album.iRating);
home->SetProperty("LatestAlbum." + value + ".Path" , strDBpath);
home->SetProperty("LatestAlbum." + value + ".Thumb" , strThumb);
home->SetProperty("LatestAlbum." + value + ".Fanart" , strFanart);
}
}
for (; i < NUM_ITEMS; ++i)
{
std::string value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestAlbum." + value + ".Title" , "");
home->SetProperty("LatestAlbum." + value + ".Year" , "");
home->SetProperty("LatestAlbum." + value + ".Artist" , "");
home->SetProperty("LatestAlbum." + value + ".Rating" , "");
home->SetProperty("LatestAlbum." + value + ".Path" , "");
home->SetProperty("LatestAlbum." + value + ".Thumb" , "");
//.........这里部分代码省略.........