本文整理汇总了C++中CMusicThumbLoader::LoadItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicThumbLoader::LoadItem方法的具体用法?C++ CMusicThumbLoader::LoadItem怎么用?C++ CMusicThumbLoader::LoadItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicThumbLoader
的用法示例。
在下文中一共展示了CMusicThumbLoader::LoadItem方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAlbum
void CGUIDialogMusicInfo::SetAlbum(const CAlbum& album, const std::string &path)
{
m_album = album;
SetSongs(m_album.songs);
*m_albumItem = CFileItem(path, true);
m_albumItem->GetMusicInfoTag()->SetAlbum(m_album);
CMusicDatabase::SetPropertiesFromAlbum(*m_albumItem,m_album);
CMusicThumbLoader loader;
loader.LoadItem(m_albumItem.get());
// set the artist thumb, fanart
if (!m_album.GetAlbumArtist().empty())
{
CMusicDatabase db;
db.Open();
std::map<std::string, std::string> artwork;
if (db.GetArtistArtForItem(m_album.idAlbum, MediaTypeAlbum, artwork))
{
if (artwork.find("thumb") != artwork.end())
m_albumItem->SetProperty("artistthumb", artwork["thumb"]);
if (artwork.find("fanart") != artwork.end())
m_albumItem->SetArt("fanart",artwork["fanart"]);
}
}
m_startUserrating = m_album.iUserrating;
m_hasUpdatedThumb = false;
m_bArtistInfo = false;
m_needsUpdate = false;
m_albumSongs->SetContent("albums");
}
示例2: SetDiscography
void CGUIDialogMusicInfo::SetDiscography(CMusicDatabase& database) const
{
m_albumSongs->Clear();
database.GetArtistDiscography(m_artist.idArtist, *m_albumSongs);
CMusicThumbLoader loader;
for (auto item : *m_albumSongs)
{
// Load all the album art and related artist(s) art (could be other collaborating artists)
loader.LoadItem(item.get());
if (item->GetMusicInfoTag()->GetDatabaseId() == -1)
item->SetArt("thumb", "DefaultAlbumCover.png");
}
}
示例3: SetSongs
void CGUIDialogMusicInfo::SetSongs(const VECSONGS &songs) const
{
m_albumSongs->Clear();
CMusicThumbLoader loader;
for (unsigned int i = 0; i < songs.size(); i++)
{
const CSong& song = songs[i];
CFileItemPtr item(new CFileItem(song));
// Load the song art and related artist(s) (that may be different from album artist) art
loader.LoadItem(item.get());
m_albumSongs->Add(item);
}
}
示例4: GetPlaylistInfo
bool CMusicGUIInfo::GetPlaylistInfo(std::string& value, const CGUIInfo &info) const
{
PLAYLIST::CPlayList& playlist = CServiceBroker::GetPlaylistPlayer().GetPlaylist(PLAYLIST_MUSIC);
if (playlist.size() < 1)
return false;
int index = info.GetData2();
if (info.GetData1() == 1)
{ // relative index (requires current playlist is PLAYLIST_MUSIC)
if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() != PLAYLIST_MUSIC)
return false;
index = CServiceBroker::GetPlaylistPlayer().GetNextSong(index);
}
if (index < 0 || index >= playlist.size())
return false;
const CFileItemPtr playlistItem = playlist[index];
if (!playlistItem->GetMusicInfoTag()->Loaded())
{
playlistItem->LoadMusicTag();
playlistItem->GetMusicInfoTag()->SetLoaded();
}
// try to set a thumbnail
if (!playlistItem->HasArt("thumb"))
{
CMusicThumbLoader loader;
loader.LoadItem(playlistItem.get());
// still no thumb? then just the set the default cover
if (!playlistItem->HasArt("thumb"))
playlistItem->SetArt("thumb", "DefaultAlbumCover.png");
}
if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
{
value = StringUtils::Format("%i", index + 1);
return true;
}
else if (info.m_info == MUSICPLAYER_COVER)
{
value = playlistItem->GetArt("thumb");
return true;
}
return GetLabel(value, playlistItem.get(), 0, CGUIInfo(info.m_info), nullptr);
}
示例5: SetArtist
void CGUIDialogMusicInfo::SetArtist(const CArtist& artist, const std::string &path)
{
m_artist = artist;
SetDiscography();
*m_albumItem = CFileItem(path, true);
m_albumItem->SetLabel(artist.strArtist);
m_albumItem->GetMusicInfoTag()->SetAlbumArtist(m_artist.strArtist);
m_albumItem->GetMusicInfoTag()->SetArtist(m_artist.strArtist);
m_albumItem->GetMusicInfoTag()->SetLoaded(true);
m_albumItem->GetMusicInfoTag()->SetGenre(m_artist.genre);
m_albumItem->GetMusicInfoTag()->SetDatabaseId(m_artist.idArtist, MediaTypeArtist);
CMusicDatabase::SetPropertiesFromArtist(*m_albumItem,m_artist);
CMusicThumbLoader loader;
loader.LoadItem(m_albumItem.get());
m_hasUpdatedThumb = false;
m_bArtistInfo = true;
m_albumSongs->SetContent("artists");
}
示例6: InitCurrentItem
bool CMusicGUIInfo::InitCurrentItem(CFileItem *item)
{
if (item && (item->IsAudio() || (item->IsInternetStream() && g_application.GetAppPlayer().IsPlayingAudio())))
{
CLog::Log(LOGDEBUG,"CMusicGUIInfo::InitCurrentItem(%s)", item->GetPath().c_str());
item->LoadMusicTag();
CMusicInfoTag* tag = item->GetMusicInfoTag(); // creates item if not yet set, so no nullptr checks needed
if (tag->GetTitle().empty())
{
// No title in tag, show filename only
tag->SetTitle(CUtil::GetTitleFromPath(item->GetPath()));
}
tag->SetLoaded(true);
// find a thumb for this file.
if (item->IsInternetStream())
{
if (!g_application.m_strPlayListFile.empty())
{
CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
CFileItem streamingItem(g_application.m_strPlayListFile,false);
CMusicThumbLoader loader;
loader.FillThumb(streamingItem);
if (streamingItem.HasArt("thumb"))
item->SetArt("thumb", streamingItem.GetArt("thumb"));
}
}
else
{
CMusicThumbLoader loader;
loader.LoadItem(item);
}
CMusicInfoLoader::LoadAdditionalTagInfo(item);
return true;
}
return false;
}
示例7: SetAlbum
void CGUIDialogMusicInfo::SetAlbum(const CAlbum& album, const CStdString &path)
{
m_album = album;
SetSongs(m_album.songs);
*m_albumItem = CFileItem(path, true);
m_albumItem->GetMusicInfoTag()->SetAlbum(m_album.strAlbum);
m_albumItem->GetMusicInfoTag()->SetAlbumArtist(StringUtils::Join(m_album.artist, g_advancedSettings.m_musicItemSeparator));
m_albumItem->GetMusicInfoTag()->SetArtist(m_album.artist);
m_albumItem->GetMusicInfoTag()->SetYear(m_album.iYear);
m_albumItem->GetMusicInfoTag()->SetLoaded(true);
m_albumItem->GetMusicInfoTag()->SetRating('0' + m_album.iRating);
m_albumItem->GetMusicInfoTag()->SetGenre(m_album.genre);
m_albumItem->GetMusicInfoTag()->SetDatabaseId(m_album.idAlbum, "album");
CMusicDatabase::SetPropertiesFromAlbum(*m_albumItem,m_album);
CMusicThumbLoader loader;
loader.LoadItem(m_albumItem.get());
// set the artist thumb, fanart
if (!m_album.artist.empty())
{
CMusicDatabase db;
db.Open();
map<string, string> artwork;
if (db.GetArtistArtForItem(m_album.idAlbum, "album", artwork))
{
if (artwork.find("thumb") != artwork.end())
m_albumItem->SetProperty("artistthumb", artwork["thumb"]);
if (artwork.find("fanart") != artwork.end())
m_albumItem->SetProperty("fanart_image",artwork["fanart"]);
}
}
m_hasUpdatedThumb = false;
m_bArtistInfo = false;
m_albumSongs->SetContent("albums");
}
示例8: 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" , "");
//.........这里部分代码省略.........
示例9: 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.Initialize();
musicdatabase.Open();
if (musicdatabase.GetRecentlyAddedAlbumSongs("musicdb://4/", musicItems, NUM_ITEMS))
{
long idAlbum = -1;
CStdString strAlbumThumb;
CStdString strAlbumFanart;
for (; i < musicItems.Size(); ++i)
{
CFileItemPtr item = musicItems.Get(i);
CStdString value;
value.Format("%i", i + 1);
CStdString strRating;
CStdString strAlbum = item->GetMusicInfoTag()->GetAlbum();
CStdString strArtist = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator);
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.Format("%c", item->GetMusicInfoTag()->GetRating());
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)
{
CStdString value;
value.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)
{
CStdString value;
CStdString strPath;
CStdString strThumb;
CStdString strFanart;
CStdString strDBpath;
CStdString strSQLAlbum;
CAlbum& album=albums[i];
value.Format("%i", i + 1);
strThumb = musicdatabase.GetArtForItem(album.idAlbum, "album", "thumb");
strFanart = musicdatabase.GetArtistArtForItem(album.idAlbum, "album", "fanart");
strDBpath.Format("musicdb://3/%i/", album.idAlbum);
strSQLAlbum.Format("idAlbum=%i", album.idAlbum);
CStdString strArtist = musicdatabase.GetSingleValue("albumview", "strArtists", strSQLAlbum);
home->SetProperty("LatestAlbum." + value + ".Title" , album.strAlbum);
home->SetProperty("LatestAlbum." + value + ".Year" , album.iYear);
home->SetProperty("LatestAlbum." + value + ".Artist" , strArtist);
home->SetProperty("LatestAlbum." + value + ".Rating" , album.iRating);
home->SetProperty("LatestAlbum." + value + ".Path" , strDBpath);
home->SetProperty("LatestAlbum." + value + ".Thumb" , strThumb);
//.........这里部分代码省略.........
示例10: DoWork
// Fetch full album/artist information including art types list
bool DoWork() override
{
CGUIDialogMusicInfo *dialog = CServiceBroker::GetGUI()->GetWindowManager().
GetWindow<CGUIDialogMusicInfo>(WINDOW_DIALOG_MUSIC_INFO);
if (!dialog)
return false;
if (dialog->IsCancelled())
return false;
CFileItemPtr m_item = dialog->GetCurrentListItem();
CMusicInfoTag& tag = *m_item->GetMusicInfoTag();
CMusicDatabase database;
database.Open();
// May only have partially populated item, so fetch all artist or album data from db
if (tag.GetType() == MediaTypeArtist)
{
int artistId = tag.GetDatabaseId();
CArtist artist;
if (!database.GetArtist(artistId, artist))
return false;
tag.SetArtist(artist);
CMusicDatabase::SetPropertiesFromArtist(*m_item, artist);
m_item->SetLabel(artist.strArtist);
// Get artist folder where local art could be found
// Get the *name* of the folder for this artist within the Artist Info folder (may not exist).
// If there is no Artist Info folder specified in settings this will be blank
database.GetArtistPath(artist, artist.strPath);
// Get the old location for those album artists with a unique folder (local to music files)
// If there is no folder for the artist and *only* the artist this will be blank
std::string oldartistpath;
bool oldpathfound = database.GetOldArtistPath(artist.idArtist, oldartistpath);
// Set up path for *item folder when browsing for art, by default this is
// in the Artist Info Folder (when it exists), but could end up blank
std::string artistItemPath = artist.strPath;
if (!CDirectory::Exists(artistItemPath))
{
// Fall back local to music files (historic location for those album artists with a unique folder)
// although there may not be such a unique folder for the arist
if (oldpathfound)
artistItemPath = oldartistpath;
else
// Fall back further to browse the Artist Info Folder itself
artistItemPath = CServiceBroker::GetSettings().GetString(CSettings::SETTING_MUSICLIBRARY_ARTISTSFOLDER);
}
m_item->SetPath(artistItemPath);
// Store info as CArtist as well as item properties
dialog->SetArtist(artist, oldartistpath);
// Fetch artist discography as scraped from online sources, but always
// include all the albums in the music library
dialog->SetDiscography(database);
}
else
{
// tag.GetType == MediaTypeAlbum
int albumId = tag.GetDatabaseId();
CAlbum album;
if (!database.GetAlbum(albumId, album))
return false;
tag.SetAlbum(album);
CMusicDatabase::SetPropertiesFromAlbum(*m_item, album);
// Get album folder where local art could be found
database.GetAlbumPath(albumId, album.strPath);
// Set up path for *item folder when browsing for art
m_item->SetPath(album.strPath);
// Store info as CAlbum as well as item properties
dialog->SetAlbum(album, album.strPath);
// Set the list of songs and related art
dialog->SetSongs(album.songs);
}
database.Close();
/*
Load current art (to CGUIListItem.m_art)
For albums this includes related artist(s) art and artist fanart set as
fallback album fanart.
Clear item art first to ensure fresh not cached/partial art
*/
m_item->ClearArt();
CMusicThumbLoader loader;
loader.LoadItem(m_item.get());
// Fill vector of possible art types with current art, when it exists,
// for display on the art type selection dialog
CFileItemList artlist;
MUSIC_UTILS::FillArtTypesList(*m_item, artlist);
dialog->SetArtTypeList(artlist);
if (dialog->IsCancelled())
return false;
// Tell waiting MusicDialog that job is complete
dialog->FetchComplete();
return true;
//.........这里部分代码省略.........