本文整理汇总了C++中CGUIDialogMusicInfo::SetSongs方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogMusicInfo::SetSongs方法的具体用法?C++ CGUIDialogMusicInfo::SetSongs怎么用?C++ CGUIDialogMusicInfo::SetSongs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogMusicInfo
的用法示例。
在下文中一共展示了CGUIDialogMusicInfo::SetSongs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
//.........这里部分代码省略.........