本文整理汇总了C++中CFileItem::SetArt方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::SetArt方法的具体用法?C++ CFileItem::SetArt怎么用?C++ CFileItem::SetArt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::SetArt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillThumb
bool CVideoThumbLoader::FillThumb(CFileItem &item)
{
if (item.HasArt("thumb"))
return true;
std::string thumb = GetCachedImage(item, "thumb");
if (thumb.empty())
{
thumb = GetLocalArt(item, "thumb");
if (!thumb.empty())
SetCachedImage(item, "thumb", thumb);
}
if (!thumb.empty())
item.SetArt("thumb", thumb);
else
{
// If nothing was found, try embedded art
if (item.HasVideoInfoTag() && !item.GetVideoInfoTag()->m_coverArt.empty())
{
for (auto& it : item.GetVideoInfoTag()->m_coverArt)
{
if (it.m_type == "thumb")
{
thumb = CTextureUtils::GetWrappedImageURL(item.GetPath(), "video_" + it.m_type);
item.SetArt(it.m_type, thumb);
}
}
}
}
return !thumb.empty();
}
示例2: CreateFileItem
CFileItem* CSavestateDatabase::CreateFileItem(const CVariant& object) const
{
using namespace ADDON;
CSavestate save;
save.Deserialize(object);
CFileItem* item = new CFileItem(save.Label());
item->SetPath(save.Path());
if (!save.Thumbnail().empty())
item->SetArt("thumb", save.Thumbnail());
else
{
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(save.GameClient(), addon, ADDON_GAMEDLL))
item->SetArt("thumb", addon->Icon());
}
// Use the slot number as the second label
if (save.Type() == SAVETYPE::SLOT)
item->SetLabel2(StringUtils::Format("%u", save.Slot()));
item->m_dateTime = save.Timestamp();
item->SetProperty(FILEITEM_PROPERTY_SAVESTATE_DURATION, static_cast<uint64_t>(save.PlaytimeWallClock()));
item->GetGameInfoTag()->SetGameClient(save.GameClient());
item->m_dwSize = save.Size();
item->m_bIsFolder = false;
return item;
}
示例3: FillLibraryArt
bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
{
CVideoInfoTag &tag = *item.GetVideoInfoTag();
if (tag.m_iDbId > -1 && !tag.m_type.empty())
{
std::map<std::string, std::string> artwork;
m_videoDatabase->Open();
if (m_videoDatabase->GetArtForItem(tag.m_iDbId, tag.m_type, artwork))
SetArt(item, artwork);
else if (tag.m_type == "actor" && !tag.m_artist.empty())
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idArtist = database.GetArtistByName(item.GetLabel());
if (database.GetArtForItem(idArtist, MediaTypeArtist, artwork))
item.SetArt(artwork);
}
else if (tag.m_type == MediaTypeAlbum)
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idAlbum = database.GetAlbumByName(item.GetLabel(), tag.m_artist);
if (database.GetArtForItem(idAlbum, MediaTypeAlbum, artwork))
item.SetArt(artwork);
}
if (tag.m_type == MediaTypeEpisode || tag.m_type == MediaTypeSeason)
{
// For episodes and seasons, we want to set fanart for that of the show
if (!item.HasArt("tvshow.fanart") && tag.m_iIdShow >= 0)
{
const ArtMap& artmap = GetArtFromCache(MediaTypeTvShow, tag.m_iIdShow);
if (!artmap.empty())
{
item.AppendArt(artmap, MediaTypeTvShow);
item.SetArtFallback("fanart", "tvshow.fanart");
item.SetArtFallback("tvshow.thumb", "tvshow.poster");
}
}
if (tag.m_type == MediaTypeEpisode && !item.HasArt("season.poster") && tag.m_iSeason > -1)
{
const ArtMap& artmap = GetArtFromCache(MediaTypeSeason, tag.m_iIdSeason);
if (!artmap.empty())
item.AppendArt(artmap, MediaTypeSeason);
}
}
else if (tag.m_type == MediaTypeMovie && tag.m_set.id >= 0 && !item.HasArt("set.fanart"))
{
const ArtMap& artmap = GetArtFromCache(MediaTypeVideoCollection, tag.m_set.id);
if (!artmap.empty())
item.AppendArt(artmap, MediaTypeVideoCollection);
}
m_videoDatabase->Close();
}
return !item.GetArt().empty();
}
示例4: FillLibraryArt
bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
{
CVideoInfoTag &tag = *item.GetVideoInfoTag();
if (tag.m_iDbId > -1 && !tag.m_type.IsEmpty())
{
map<string, string> artwork;
m_database->Open();
if (m_database->GetArtForItem(tag.m_iDbId, tag.m_type, artwork))
item.SetArt(artwork);
else if (tag.m_type == "artist")
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idArtist = database.GetArtistByName(item.GetLabel());
if (database.GetArtForItem(idArtist, "artist", artwork))
item.SetArt(artwork);
}
else if (tag.m_type == "album")
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idAlbum = database.GetAlbumByName(item.GetLabel(), tag.m_artist);
if (database.GetArtForItem(idAlbum, "album", artwork))
item.SetArt(artwork);
}
// For episodes and seasons, we want to set fanart for that of the show
if (!item.HasArt("fanart") && tag.m_iIdShow >= 0)
{
ArtCache::const_iterator i = m_showArt.find(tag.m_iIdShow);
if (i != m_showArt.end())
item.AppendArt(i->second);
else
{
map<string, string> showArt, cacheArt;
if (m_database->GetArtForItem(tag.m_iIdShow, "tvshow", showArt))
{
for (CGUIListItem::ArtMap::iterator i = showArt.begin(); i != showArt.end(); ++i)
{
if (i->first == "fanart")
cacheArt.insert(*i);
else
cacheArt.insert(make_pair("tvshow." + i->first, i->second));
}
item.AppendArt(cacheArt);
}
m_showArt.insert(make_pair(tag.m_iIdShow, cacheArt));
}
}
m_database->Close();
}
return !item.GetArt().empty();
}
示例5: FillLibraryArt
bool CMusicThumbLoader::FillLibraryArt(CFileItem &item)
{
CMusicInfoTag &tag = *item.GetMusicInfoTag();
if (tag.GetDatabaseId() > -1 && !tag.GetType().empty())
{
m_musicDatabase->Open();
map<string, string> artwork;
if (m_musicDatabase->GetArtForItem(tag.GetDatabaseId(), tag.GetType(), artwork))
item.SetArt(artwork);
else if (tag.GetType() == "song")
{ // no art for the song, try the album
ArtCache::const_iterator i = m_albumArt.find(tag.GetAlbumId());
if (i == m_albumArt.end())
{
m_musicDatabase->GetArtForItem(tag.GetAlbumId(), "album", artwork);
i = m_albumArt.insert(make_pair(tag.GetAlbumId(), artwork)).first;
}
if (i != m_albumArt.end())
{
item.AppendArt(i->second, "album");
for (map<string, string>::const_iterator j = i->second.begin(); j != i->second.end(); ++j)
item.SetArtFallback(j->first, "album." + j->first);
}
}
if (tag.GetType() == "song" || tag.GetType() == "album")
{ // fanart from the artist
string fanart = m_musicDatabase->GetArtistArtForItem(tag.GetDatabaseId(), tag.GetType(), "fanart");
if (!fanart.empty())
{
item.SetArt("artist.fanart", fanart);
item.SetArtFallback("fanart", "artist.fanart");
}
else if (tag.GetType() == "song")
{
// If no artist fanart, try for album artist fanart
fanart = m_musicDatabase->GetArtistArtForItem(tag.GetAlbumId(), "album", "fanart");
if (!fanart.empty())
{
item.SetArt("albumartist.fanart", fanart);
item.SetArtFallback("fanart", "albumartist.fanart");
}
}
}
m_musicDatabase->Close();
}
return !item.GetArt().empty();
}
示例6: AddFavourite
JSONRPC_STATUS CFavouritesOperations::AddFavourite(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
std::string type = parameterObject["type"].asString();
if (type.compare("unknown") == 0)
return InvalidParams;
if ((type.compare("media") == 0 || type.compare("script") == 0) && !ParameterNotNull(parameterObject, "path"))
{
result["method"] = "Favourites.AddFavourite";
result["stack"]["message"] = "Missing parameter";
result["stack"]["name"] = "path";
result["stack"]["type"] = "string";
return InvalidParams;
}
if (type.compare("window") == 0 && !ParameterNotNull(parameterObject, "window"))
{
result["method"] = "Favourites.AddFavourite";
result["stack"]["message"] = "Missing parameter";
result["stack"]["name"] = "window";
result["stack"]["type"] = "string";
return InvalidParams;
}
std::string title = parameterObject["title"].asString();
std::string path = parameterObject["path"].asString();
CFileItem item;
int contextWindow = 0;
if (type.compare("window") == 0)
{
item = CFileItem(parameterObject["windowparameter"].asString(), true);
contextWindow = CWindowTranslator::TranslateWindow(parameterObject["window"].asString());
if (contextWindow == WINDOW_INVALID)
return InvalidParams;
}
else if (type.compare("script") == 0)
{
if (!URIUtils::IsScript(path))
path = "script://" + path;
item = CFileItem(path, false);
}
else if (type.compare("media") == 0)
{
item = CFileItem(path, false);
}
else
return InvalidParams;
item.SetLabel(title);
if (ParameterNotNull(parameterObject,"thumbnail"))
item.SetArt("thumb", parameterObject["thumbnail"].asString());
if (CServiceBroker::GetFavouritesService().AddOrRemove(item, contextWindow))
return ACK;
else
return FailedToExecute;
}
示例7: FillLibraryArt
bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
{
CVideoInfoTag &tag = *item.GetVideoInfoTag();
if (tag.m_iDbId > -1 && !tag.m_type.empty())
{
map<string, string> artwork;
m_videoDatabase->Open();
if (m_videoDatabase->GetArtForItem(tag.m_iDbId, tag.m_type, artwork))
SetArt(item, artwork);
else if (tag.m_type == MediaTypeArtist)
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idArtist = database.GetArtistByName(item.GetLabel());
if (database.GetArtForItem(idArtist, MediaTypeArtist, artwork))
item.SetArt(artwork);
}
else if (tag.m_type == MediaTypeAlbum)
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idAlbum = database.GetAlbumByName(item.GetLabel(), tag.m_artist);
if (database.GetArtForItem(idAlbum, MediaTypeAlbum, artwork))
item.SetArt(artwork);
}
// For episodes and seasons, we want to set fanart for that of the show
if (!item.HasArt("fanart") && tag.m_iIdShow >= 0)
{
ArtCache::const_iterator i = m_showArt.find(tag.m_iIdShow);
if (i == m_showArt.end())
{
map<string, string> showArt;
m_videoDatabase->GetArtForItem(tag.m_iIdShow, MediaTypeTvShow, showArt);
i = m_showArt.insert(make_pair(tag.m_iIdShow, showArt)).first;
}
if (i != m_showArt.end())
{
item.AppendArt(i->second, "tvshow");
item.SetArtFallback("fanart", "tvshow.fanart");
item.SetArtFallback("tvshow.thumb", "tvshow.poster");
}
}
m_videoDatabase->Close();
}
return !item.GetArt().empty();
}
示例8: FillThumb
bool CMusicThumbLoader::FillThumb(CFileItem &item, bool folderThumbs /* = true */)
{
if (item.HasArt("thumb"))
return true;
CStdString thumb = GetCachedImage(item, "thumb");
if (thumb.empty())
{
thumb = item.GetUserMusicThumb(false, folderThumbs);
if (!thumb.empty())
SetCachedImage(item, "thumb", thumb);
}
item.SetArt("thumb", thumb);
return !thumb.empty();
}
示例9: PlayTrailer
void CGUIDialogVideoInfo::PlayTrailer()
{
CFileItem item;
item.SetPath(m_movieItem->GetVideoInfoTag()->m_strTrailer);
*item.GetVideoInfoTag() = *m_movieItem->GetVideoInfoTag();
item.GetVideoInfoTag()->m_streamDetails.Reset();
item.GetVideoInfoTag()->m_strTitle.Format("%s (%s)",m_movieItem->GetVideoInfoTag()->m_strTitle.c_str(),g_localizeStrings.Get(20410));
item.SetArt(m_movieItem->GetArt());
item.GetVideoInfoTag()->m_iDbId = -1;
item.GetVideoInfoTag()->m_iFileId = -1;
// Close the dialog.
Close(true);
if (item.IsPlayList())
CApplicationMessenger::Get().MediaPlay(item);
else
CApplicationMessenger::Get().PlayFile(item);
}
示例10: UpdateItem
bool CDVDInputStreamHTSP::UpdateItem(CFileItem& item)
{
SChannels::iterator it = m_channels.find(m_channel);
if(it == m_channels.end())
return false;
SChannel& channel = it->second;
if(channel.event != m_event.id)
{
if(!m_session.GetEvent(m_event, channel.event))
{
m_event.Clear();
m_event.id = channel.event;
}
}
CFileItem current(item);
CHTSPSession::ParseItem(channel, m_tag, m_event, item);
item.SetArt("thumb", channel.icon);
return current.GetPath() != item.GetPath()
|| current.m_strTitle != item.m_strTitle;
}
示例11: SetFileItemMetaData
//.........这里部分代码省略.........
*/
CVideoInfoTag* tag = item.GetVideoInfoTag();
tag->m_strTitle = subtitle; // The title is just supposed to be the episode title.
tag->m_strShowTitle = title;
tag->m_strOriginalTitle = title;
tag->m_strPlotOutline = subtitle;
tag->m_strPlot = GetValue(m_dll->proginfo_description(program));
/*
* TODO: Strip out the subtitle from the description if it is present at the start? OR add the
* subtitle to the start of the plot if not already as it used to? Seems strange, should be
* handled by skin?
*
if (tag->m_strPlot.Left(tag->m_strPlotOutline.length()) != tag->m_strPlotOutline && !tag->m_strPlotOutline.IsEmpty())
tag->m_strPlot = tag->m_strPlotOutline + '\n' + tag->m_strPlot;
*/
tag->m_genre = StringUtils::Split(GetValue(m_dll->proginfo_category(program)), g_advancedSettings.m_videoItemSeparator); // e.g. Sports
tag->m_strAlbum = GetValue(m_dll->proginfo_chansign(program)); // e.g. TV3
tag->m_duration = m_dll->proginfo_length_sec(program);
SetSeasonAndEpisode(program, &tag->m_iSeason, &tag->m_iEpisode);
/*
* Original air date is used by the VideoInfoScanner to scrape the TV Show information into the
* Video Library. If the original air date is empty the date returned will be the epoch.
*/
CStdString originalairdate = GetValue(m_dll->proginfo_originalairdate(program)).GetAsDBDate();
if (originalairdate != "1970-01-01"
&& originalairdate != "1969-12-31")
tag->m_firstAired.SetFromDateString(originalairdate);
/*
* Video sort title is the raw title with the date appended on the end in a sortable format so
* when the "All Recordings" listing is sorted by "Name" rather than "Date", all of the episodes
* for a given show are still presented in date order (even though some may have a subtitle that
* would cause it to be shown in a different position if it was indeed strictly sorting by
* what is displayed in the list).
*/
tag->m_strSortTitle = title + " " + item.m_dateTime.GetAsDBDateTime(); // e.g. Mythbusters 2009-12-13 12:23:14
/*
* Set further FileItem and VideoInfoTag meta-data based on whether it is LiveTV or not.
*/
CURL url(item.GetPath());
if (url.GetFileName().Left(9) == "channels/")
{
/*
* Prepend the channel number onto the FileItem title for the listing so it's clear what is
* playing on each channel without using up as much room as the channel name.
*/
CStdString number = GetValue(m_dll->proginfo_chanstr(program));
item.m_strTitle = number + " - " + item.m_strTitle;
/*
* Append the channel name onto the end of the tag title for the OSD so it's clear what LiveTV
* channel is currently being watched to give some context for Next or Previous channel. Added
* to the end so sorting by title will work, and it's not really as important as the title
* within the OSD.
*/
CStdString name = GetValue(m_dll->proginfo_chansign(program));
if (!name.IsEmpty())
tag->m_strTitle += " - " + name;
/*
* Set the sort title to be the channel number.
*/
tag->m_strSortTitle = number;
/*
* Set the status so XBMC treats the content as LiveTV.
*/
tag->m_strStatus = "livetv";
/*
* Update the path and channel icon for LiveTV in case the channel has changed through
* NextChannel(), PreviousChannel() or SetChannel().
*/
if (!number.IsEmpty())
{
url.SetFileName("channels/" + number + ".ts"); // e.g. channels/3.ts
item.SetPath(url.Get());
}
CStdString chanicon = GetValue(m_dll->proginfo_chanicon(program));
if (!chanicon.IsEmpty())
{
url.SetFileName("files/channels/" + URIUtils::GetFileName(chanicon)); // e.g. files/channels/tv3.jpg
item.SetArt("thumb", url.Get());
}
}
else
{
/*
* MythTV thumbnails aren't generated until a program has finished recording.
*/
if (m_dll->proginfo_rec_status(program) == RS_RECORDED)
{
url.SetFileName("files/" + URIUtils::GetFileName(GetValue(m_dll->proginfo_pathname(program))) + ".png");
item.SetArt("thumb", url.Get());
}
}
}