本文整理汇总了C++中CTextureDatabase::InvalidateCachedTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CTextureDatabase::InvalidateCachedTexture方法的具体用法?C++ CTextureDatabase::InvalidateCachedTexture怎么用?C++ CTextureDatabase::InvalidateCachedTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTextureDatabase
的用法示例。
在下文中一共展示了CTextureDatabase::InvalidateCachedTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoWork
bool CRepositoryUpdateJob::DoWork()
{
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] checking for updates.", m_repo->ID().c_str());
CAddonDatabase database;
database.Open();
std::string oldChecksum;
if (database.GetRepoChecksum(m_repo->ID(), oldChecksum) == -1)
oldChecksum = "";
std::string newChecksum;
VECADDONS addons;
auto status = m_repo->FetchIfChanged(oldChecksum, newChecksum, addons);
database.SetLastChecked(m_repo->ID(), m_repo->Version(),
CDateTime::GetCurrentDateTime().GetAsDBDateTime());
MarkFinished();
if (status == CRepository::STATUS_ERROR)
return false;
if (status == CRepository::STATUS_NOT_MODIFIED)
{
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] checksum not changed.", m_repo->ID().c_str());
return true;
}
//Invalidate art.
{
CTextureDatabase textureDB;
textureDB.Open();
textureDB.BeginMultipleExecute();
for (const auto& addon : addons)
{
AddonPtr oldAddon;
if (database.GetAddon(addon->ID(), oldAddon) && addon->Version() > oldAddon->Version())
{
if (!oldAddon->Icon().empty() || !oldAddon->Art().empty() || !oldAddon->Screenshots().empty())
CLog::Log(LOGDEBUG, "CRepository: invalidating cached art for '%s'", addon->ID().c_str());
if (!oldAddon->Icon().empty())
textureDB.InvalidateCachedTexture(oldAddon->Icon());
for (const auto& path : oldAddon->Screenshots())
textureDB.InvalidateCachedTexture(path);
for (const auto& art : oldAddon->Art())
textureDB.InvalidateCachedTexture(art.second);
}
}
textureDB.CommitMultipleExecute();
}
database.UpdateRepositoryContent(m_repo->ID(), m_repo->Version(), newChecksum, addons);
return true;
}
示例2: Work
//.........这里部分代码省略.........
}
else if (result < 0 || !VIDEO::CVideoInfoScanner::DownloadFailed(GetProgressDialog()))
{
failure = true;
break;
}
}
// if the URL is still empty, check whether or not we're allowed
// to prompt and ask the user to input a new search title
if (!hasDetails && scraperUrl.m_url.empty())
{
if (IsModal())
{
// ask the user to input a title to use
if (!CGUIKeyboardFactory::ShowAndGetInput(itemTitle, g_localizeStrings.Get(scraper->Content() == CONTENT_TVSHOWS ? 20357 : 16009), false))
return false;
// go through the whole process again
needsRefresh = true;
continue;
}
// nothing else we can do
failure = true;
break;
}
// before we start downloading all the necessary information cleanup any existing artwork and hashes
CTextureDatabase textureDb;
if (textureDb.Open())
{
for (const auto& artwork : m_item->GetArt())
textureDb.InvalidateCachedTexture(artwork.second);
textureDb.Close();
}
m_item->ClearArt();
// put together the list of items to refresh
std::string path = m_item->GetPath();
CFileItemList items;
if (m_item->HasVideoInfoTag() && m_item->GetVideoInfoTag()->m_iDbId > 0)
{
// for a tvshow we need to handle all paths of it
std::vector<std::string> tvshowPaths;
if (CMediaTypes::IsMediaType(m_item->GetVideoInfoTag()->m_type, MediaTypeTvShow) && m_refreshAll &&
db.GetPathsLinkedToTvShow(m_item->GetVideoInfoTag()->m_iDbId, tvshowPaths))
{
for (const auto& tvshowPath : tvshowPaths)
{
CFileItemPtr tvshowItem(new CFileItem(*m_item->GetVideoInfoTag()));
tvshowItem->SetPath(tvshowPath);
items.Add(tvshowItem);
}
}
// otherwise just add a copy of the item
else
items.Add(CFileItemPtr(new CFileItem(*m_item->GetVideoInfoTag())));
// update the path to the real path (instead of a videodb:// one)
path = m_item->GetVideoInfoTag()->m_strPath;
}
else
items.Add(CFileItemPtr(new CFileItem(*m_item)));
示例3: DoWork
bool CRepositoryUpdateJob::DoWork()
{
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] checking for updates.", m_repo->ID().c_str());
CAddonDatabase database;
database.Open();
std::string oldChecksum;
if (database.GetRepoChecksum(m_repo->ID(), oldChecksum) == -1)
oldChecksum = "";
std::string newChecksum;
VECADDONS addons;
auto status = m_repo->FetchIfChanged(oldChecksum, newChecksum, addons);
database.SetLastChecked(m_repo->ID(), m_repo->Version(),
CDateTime::GetCurrentDateTime().GetAsDBDateTime());
MarkFinished();
if (status == CRepository::STATUS_ERROR)
return false;
if (status == CRepository::STATUS_NOT_MODIFIED)
{
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] checksum not changed.", m_repo->ID().c_str());
return true;
}
//Invalidate art.
{
CTextureDatabase textureDB;
textureDB.Open();
textureDB.BeginMultipleExecute();
for (const auto& addon : addons)
{
AddonPtr oldAddon;
if (database.GetAddon(addon->ID(), oldAddon) && addon->Version() > oldAddon->Version())
{
if (!oldAddon->Icon().empty() || !oldAddon->FanArt().empty() || !oldAddon->Screenshots().empty())
CLog::Log(LOGDEBUG, "CRepository: invalidating cached art for '%s'", addon->ID().c_str());
if (!oldAddon->Icon().empty())
textureDB.InvalidateCachedTexture(oldAddon->Icon());
if (!oldAddon->FanArt().empty())
textureDB.InvalidateCachedTexture(oldAddon->Icon());
for (const auto& path : oldAddon->Screenshots())
textureDB.InvalidateCachedTexture(path);
}
}
textureDB.CommitMultipleExecute();
}
database.UpdateRepositoryContent(m_repo->ID(), m_repo->Version(), newChecksum, addons);
//Notify about broken status changes
for (const auto& addon : addons)
{
AddonPtr localAddon;
if (!CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon))
continue;
if (localAddon && localAddon->Version() > addon->Version())
//We have a newer version locally
continue;
AddonPtr oldAddon;
database.GetAddon(addon->ID(), oldAddon);
if (database.GetAddonVersion(addon->ID()).first > addon->Version())
//Newer version in db (ie. in a different repo)
continue;
std::string broken = addon->Broken();
bool isBroken = !addon->Broken().empty();
bool isBrokenInDb = oldAddon && !oldAddon->Broken().empty();
if (isBroken && !isBrokenInDb)
{
//newly broken
if (HELPERS::ShowYesNoDialogLines(CVariant{addon->Name()}, CVariant{24096}, CVariant{24097}, CVariant{""})
== DialogResponse::YES)
{
CAddonMgr::GetInstance().DisableAddon(addon->ID());
}
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] addon '%s' marked broken. reason: \"%s\"",
m_repo->ID().c_str(), addon->ID().c_str(), broken.c_str());
CEventLog::GetInstance().Add(EventPtr(new CAddonManagementEvent(addon, 24096)));
}
else if (!isBroken && isBrokenInDb)
{
//Unbroken
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] addon '%s' unbroken",
m_repo->ID().c_str(), addon->ID().c_str());
}
}
return true;
}