本文整理汇总了C++中CFileItemPtr::HasMusicInfoTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::HasMusicInfoTag方法的具体用法?C++ CFileItemPtr::HasMusicInfoTag怎么用?C++ CFileItemPtr::HasMusicInfoTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::HasMusicInfoTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Announce
void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, CVariant &data)
{
// Extract db id of item
CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
CStdString type;
int id = 0;
if (item->HasVideoInfoTag())
{
CVideoDatabase::VideoContentTypeToString(item->GetVideoContentType(), type);
id = item->GetVideoInfoTag()->m_iDbId;
}
else if (item->HasMusicInfoTag())
{
type = "music";
id = item->GetMusicInfoTag()->GetDatabaseId();
}
if (id > 0)
{
type += "id";
object[type] = id;
}
Announce(flag, sender, message, object);
}
示例2: SetupFanart
void CGUIWindowMusicBase::SetupFanart(CFileItemList& items)
{
// set fanart
map<CStdString, CStdString> artists;
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
CStdString strArtist;
if (item->HasProperty("fanart_image"))
continue;
if (item->HasMusicInfoTag())
strArtist = item->GetMusicInfoTag()->GetArtist();
if (item->HasVideoInfoTag())
strArtist = item->GetVideoInfoTag()->m_strArtist;
if (strArtist.IsEmpty())
continue;
map<CStdString, CStdString>::iterator artist = artists.find(item->GetMusicInfoTag()->GetArtist());
if (artist == artists.end())
{
CStdString strFanart = item->GetCachedFanart();
if (XFILE::CFile::Exists(strFanart))
item->SetProperty("fanart_image",strFanart);
else
strFanart = "";
artists.insert(make_pair(strArtist, strFanart));
}
else
item->SetProperty("fanart_image",artist->second);
}
}
示例3: ByGenre
void SSortFileItem::ByGenre(CFileItemPtr &item)
{
if (!item) return;
if (item->HasMusicInfoTag())
item->SetSortLabel(item->GetMusicInfoTag()->GetGenre());
else
item->SetSortLabel(item->GetVideoInfoTag()->m_strGenre);
}
示例4: ByGenre
void SSortFileItem::ByGenre(CFileItemPtr &item)
{
if (!item) return;
if (item->HasMusicInfoTag())
item->SetSortLabel(StringUtils::Join(item->GetMusicInfoTag()->GetGenre(), g_advancedSettings.m_musicItemSeparator));
else
item->SetSortLabel(StringUtils::Join(item->GetVideoInfoTag()->m_genre, g_advancedSettings.m_videoItemSeparator));
}
示例5: BySongTrackNum
void SSortFileItem::BySongTrackNum(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasMusicInfoTag())
label.Format("%i", item->GetMusicInfoTag()->GetTrackAndDiskNumber());
if (item->HasVideoInfoTag())
label.Format("%i", item->GetVideoInfoTag()->m_iTrack);
item->SetSortLabel(label);
}
示例6: ByYear
void SSortFileItem::ByYear(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasMusicInfoTag())
label.Format("%i %s", item->GetMusicInfoTag()->GetYear(), item->GetLabel().c_str());
else
label.Format("%s %s %i %s", item->GetVideoInfoTag()->m_premiered.GetAsDBDate().c_str(), item->GetVideoInfoTag()->m_firstAired.GetAsDBDate(), item->GetVideoInfoTag()->m_iYear, item->GetLabel().c_str());
item->SetSortLabel(label);
}
示例7: ByLastPlayed
void SSortFileItem::ByLastPlayed(CFileItemPtr &item)
{
if (!item) return;
if (item->HasVideoInfoTag())
item->SetSortLabel(item->GetVideoInfoTag()->m_lastPlayed.GetAsDBDateTime());
else if (item->HasMusicInfoTag()) // TODO: No last played info in the fileitem for music
item->SetSortLabel(item->GetMusicInfoTag()->GetTitle());
else
item->SetSortLabel(item->GetLabel());
}
示例8: ByPlayCount
void SSortFileItem::ByPlayCount(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasVideoInfoTag())
label.Format("%i %s", item->GetVideoInfoTag()->m_playCount, item->GetLabel().c_str());
if (item->HasMusicInfoTag())
label.Format("%i %s", item->GetMusicInfoTag()->GetPlayCount(), item->GetLabel().c_str());
item->SetSortLabel(label);
}
示例9: BySongAlbumNoThe
void SSortFileItem::BySongAlbumNoThe(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasMusicInfoTag())
label = item->GetMusicInfoTag()->GetAlbum();
else if (item->HasVideoInfoTag())
label = item->GetVideoInfoTag()->m_strAlbum;
label = RemoveArticles(label);
CStdString artist;
if (item->HasMusicInfoTag())
artist = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator);
else if (item->HasVideoInfoTag())
artist = item->GetVideoInfoTag()->m_strArtist;
label += " " + RemoveArticles(artist);
if (item->HasMusicInfoTag())
label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber());
item->SetSortLabel(label);
}
示例10: BySongAlbum
void SSortFileItem::BySongAlbum(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasMusicInfoTag())
label = item->GetMusicInfoTag()->GetAlbum();
else if (item->HasVideoInfoTag())
label = item->GetVideoInfoTag()->m_strAlbum;
CStdString artist;
if (item->HasMusicInfoTag())
artist = item->GetMusicInfoTag()->GetArtist();
else if (item->HasVideoInfoTag())
artist = item->GetVideoInfoTag()->m_strArtist;
label += " " + artist;
if (item->HasMusicInfoTag())
label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber());
item->SetSortLabel(label);
}
示例11: OnLoaderFinish
void CMusicInfoLoader::OnLoaderFinish()
{
// cleanup last loaded songs from database
m_songsMap.Clear();
// cleanup cache loaded from HD
m_mapFileItems->Clear();
if (!m_bStop)
{ // check for art
VECSONGS songs;
songs.reserve(m_pVecItems->Size());
for (int i = 0; i < m_pVecItems->Size(); ++i)
{
CFileItemPtr pItem = m_pVecItems->Get(i);
if (pItem->m_bIsFolder || pItem->IsPlayList() || pItem->IsNFO() || pItem->IsInternetStream())
continue;
if (pItem->HasMusicInfoTag() && pItem->GetMusicInfoTag()->Loaded())
{
CSong song(*pItem->GetMusicInfoTag());
song.strThumb = pItem->GetArt("thumb");
song.idSong = i; // for the lookup below
songs.push_back(song);
}
}
VECALBUMS albums;
CMusicInfoScanner::CategoriseAlbums(songs, albums);
CMusicInfoScanner::FindArtForAlbums(albums, m_pVecItems->GetPath());
for (VECALBUMS::iterator i = albums.begin(); i != albums.end(); ++i)
{
string albumArt = i->art["thumb"];
for (VECSONGS::iterator j = i->songs.begin(); j != i->songs.end(); ++j)
{
if (!j->strThumb.empty())
m_pVecItems->Get(j->idSong)->SetArt("thumb", j->strThumb);
else
m_pVecItems->Get(j->idSong)->SetArt("thumb", albumArt);
}
}
}
// Save loaded items to HD
if (!m_strCacheFileName.IsEmpty())
SaveCache(m_strCacheFileName, *m_pVecItems);
else if (!m_bStop && (m_databaseHits > 1 || m_tagReads > 0))
m_pVecItems->Save();
m_musicDatabase.Close();
}
示例12: Add
void CPartyModeManager::Add(CFileItemPtr &pItem)
{
int iPlaylist = m_bIsVideo ? PLAYLIST_VIDEO : PLAYLIST_MUSIC;
if (pItem->HasMusicInfoTag())
{
CMusicDatabase database;
database.Open();
database.SetPropertiesForFileItem(*pItem);
}
CPlayList& playlist = g_playlistPlayer.GetPlaylist(iPlaylist);
playlist.Add(pItem);
CLog::Log(LOGINFO,"PARTY MODE MANAGER: Adding randomly selected song at %i:[%s]", playlist.size() - 1, pItem->GetPath().c_str());
m_iMatchingSongsPicked++;
}
示例13: MetadataPercentage
float CAutoSwitch::MetadataPercentage(const CFileItemList &vecItems)
{
int count = 0;
int total = vecItems.Size();
for (int i = 0; i < vecItems.Size(); i++)
{
const CFileItemPtr item = vecItems[i];
if(item->HasMusicInfoTag()
|| item->HasVideoInfoTag()
|| item->HasPictureInfoTag()
|| item->HasProperty("Addon.ID"))
count++;
if(item->IsParentFolder())
total--;
}
return (float)count / total;
}
示例14: OnPrepareFileItems
void CGUIWindowMusicNav::OnPrepareFileItems(CFileItemList &items)
{
CGUIWindowMusicBase::OnPrepareFileItems(items);
// set fanart
map<CStdString, CStdString> artists;
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
if (!item->HasMusicInfoTag() || item->HasProperty("fanart_image"))
continue;
map<CStdString, CStdString>::iterator artist = artists.find(item->GetMusicInfoTag()->GetArtist());
if (artist == artists.end())
{
CStdString strFanart = item->GetCachedFanart();
if (XFILE::CFile::Exists(strFanart))
item->SetProperty("fanart_image",strFanart);
else
strFanart = "";
artists.insert(make_pair(item->GetMusicInfoTag()->GetArtist(), strFanart));
}
else
item->SetProperty("fanart_image",artist->second);
}
}
示例15: GetField
bool CFileItemHandler::GetField(const std::string &field, const CVariant &info, const CFileItemPtr &item, CVariant &result, bool &fetchedArt, CThumbLoader *thumbLoader /* = NULL */)
{
if (result.isMember(field) && !result[field].empty())
return true;
// overwrite serialized values
if (item)
{
if (field == "mimetype" && item->GetMimeType().empty())
{
item->FillInMimeType(false);
result[field] = item->GetMimeType();
return true;
}
}
// check for serialized values
if (info.isMember(field) && !info[field].isNull())
{
result[field] = info[field];
return true;
}
// check if the field requires special handling
if (item)
{
if (item->IsAlbum())
{
if (field == "albumlabel")
{
result[field] = item->GetProperty("album_label");
return true;
}
if (item->HasProperty("album_" + field + "_array"))
{
result[field] = item->GetProperty("album_" + field + "_array");
return true;
}
if (item->HasProperty("album_" + field))
{
result[field] = item->GetProperty("album_" + field);
return true;
}
}
if (item->HasProperty("artist_" + field + "_array"))
{
result[field] = item->GetProperty("artist_" + field + "_array");
return true;
}
if (item->HasProperty("artist_" + field))
{
result[field] = item->GetProperty("artist_" + field);
return true;
}
if (field == "art")
{
if (thumbLoader != NULL && item->GetArt().size() <= 0 && !fetchedArt &&
((item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > -1) || (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > -1)))
{
thumbLoader->FillLibraryArt(*item);
fetchedArt = true;
}
CGUIListItem::ArtMap artMap = item->GetArt();
CVariant artObj(CVariant::VariantTypeObject);
for (CGUIListItem::ArtMap::const_iterator artIt = artMap.begin(); artIt != artMap.end(); ++artIt)
{
if (!artIt->second.empty())
artObj[artIt->first] = CTextureCache::GetWrappedImageURL(artIt->second);
}
result["art"] = artObj;
return true;
}
if (field == "thumbnail")
{
if (thumbLoader != NULL && !item->HasArt("thumb") && !fetchedArt &&
((item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > -1) || (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > -1)))
{
thumbLoader->FillLibraryArt(*item);
fetchedArt = true;
}
else if (item->HasPictureInfoTag() && !item->HasArt("thumb"))
item->SetArt("thumb", CTextureCache::GetWrappedThumbURL(item->GetPath()));
if (item->HasArt("thumb"))
result["thumbnail"] = CTextureCache::GetWrappedImageURL(item->GetArt("thumb"));
else
result["thumbnail"] = "";
return true;
}
if (field == "fanart")
{
if (thumbLoader != NULL && !item->HasArt("fanart") && !fetchedArt &&
((item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > -1) || (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > -1)))
//.........这里部分代码省略.........