当前位置: 首页>>代码示例>>C++>>正文


C++ CMusicInfoScanner::GetArtistArtwork方法代码示例

本文整理汇总了C++中CMusicInfoScanner::GetArtistArtwork方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoScanner::GetArtistArtwork方法的具体用法?C++ CMusicInfoScanner::GetArtistArtwork怎么用?C++ CMusicInfoScanner::GetArtistArtwork使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMusicInfoScanner的用法示例。


在下文中一共展示了CMusicInfoScanner::GetArtistArtwork方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FillLibraryArt

bool CMusicThumbLoader::FillLibraryArt(CFileItem &item)
{
  CMusicInfoTag &tag = *item.GetMusicInfoTag();
  if (tag.GetDatabaseId() > -1 && !tag.GetType().empty())
  {
    m_database->Open();
    map<string, string> artwork;
    if (m_database->GetArtForItem(tag.GetDatabaseId(), tag.GetType(), artwork))
      item.SetArt(artwork);
    else if (tag.GetType() == "song")
    { // no art for the song, try the album
      if (m_database->GetArtForItem(tag.GetAlbumId(), "album", artwork))
        item.SetArt(artwork);
    }
    else if (tag.GetType() == "artist")
    {
      { // Need the artist thumb/fanart which isn't grabbed during normal directory fetches
        CArtist artist;
        m_database->GetArtistInfo(tag.GetDatabaseId(), artist, false);
        CMusicInfoScanner scanner;
        artwork = scanner.GetArtistArtwork(tag.GetDatabaseId(), &artist);
        item.SetArt(artwork);
      }
      // add to the database for next time around
      map<string, string> artwork = item.GetArt();
      if (!artwork.empty())
      {
        m_database->SetArtForItem(tag.GetDatabaseId(), tag.GetType(), artwork);
        for (map<string, string>::iterator i = artwork.begin(); i != artwork.end(); ++i)
          CTextureCache::Get().BackgroundCacheImage(i->second);
      }
      else // nothing found - set an empty thumb so that next time around we don't hit here again
        m_database->SetArtForItem(tag.GetDatabaseId(), tag.GetType(), "thumb", "");
    }
    if (tag.GetType() == "song" || tag.GetType() == "album")
    { // fanart from the artist
      item.SetProperty("fanart_image", m_database->GetArtistArtForItem(tag.GetDatabaseId(), tag.GetType(), "fanart"));
    }
    m_database->Close();
  }
  return !item.GetArt().empty();
}
开发者ID:,项目名称:,代码行数:42,代码来源:


注:本文中的CMusicInfoScanner::GetArtistArtwork方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。