本文整理汇总了C++中AddonPtr::FanArt方法的典型用法代码示例。如果您正苦于以下问题:C++ AddonPtr::FanArt方法的具体用法?C++ AddonPtr::FanArt怎么用?C++ AddonPtr::FanArt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddonPtr
的用法示例。
在下文中一共展示了AddonPtr::FanArt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddAddon
int CAddonDatabase::AddAddon(const AddonPtr& addon,
int idRepo)
{
try
{
if (NULL == m_pDB.get()) return -1;
if (NULL == m_pDS.get()) return -1;
bool bDisablePVRAddon = addon->Type() == ADDON_PVRDLL && !HasAddon(addon->ID());
CStdString sql = PrepareSQL("insert into addon (id, type, name, summary,"
"description, stars, path, icon, changelog, "
"fanart, addonID, version, author, disclaimer, minversion)"
" values(NULL, '%s', '%s', '%s', '%s', %i,"
"'%s', '%s', '%s', '%s', '%s','%s','%s','%s','%s')",
TranslateType(addon->Type(),false).c_str(),
addon->Name().c_str(), addon->Summary().c_str(),
addon->Description().c_str(),addon->Stars(),
addon->Path().c_str(), addon->Props().icon.c_str(),
addon->ChangeLog().c_str(),addon->FanArt().c_str(),
addon->ID().c_str(), addon->Version().c_str(),
addon->Author().c_str(),addon->Disclaimer().c_str(),
addon->MinVersion().c_str());
m_pDS->exec(sql.c_str());
int idAddon = (int)m_pDS->lastinsertid();
sql = PrepareSQL("insert into addonlinkrepo (idRepo, idAddon) values (%i,%i)",idRepo,idAddon);
m_pDS->exec(sql.c_str());
const InfoMap &info = addon->ExtraInfo();
for (InfoMap::const_iterator i = info.begin(); i != info.end(); ++i)
{
sql = PrepareSQL("insert into addonextra(id, key, value) values (%i, '%s', '%s')", idAddon, i->first.c_str(), i->second.c_str());
m_pDS->exec(sql.c_str());
}
const ADDONDEPS &deps = addon->GetDeps();
for (ADDONDEPS::const_iterator i = deps.begin(); i != deps.end(); ++i)
{
sql = PrepareSQL("insert into dependencies(id, addon, version, optional) values (%i, '%s', '%s', %i)", idAddon, i->first.c_str(), i->second.first.c_str(), i->second.second ? 1 : 0);
m_pDS->exec(sql.c_str());
}
// these need to be configured
if (bDisablePVRAddon)
DisableAddon(addon->ID(), true);
return idAddon;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon '%s'", __FUNCTION__, addon->Name().c_str());
}
return -1;
}
示例2: AddAddon
int CAddonDatabase::AddAddon(const AddonPtr& addon,
int idRepo)
{
try
{
if (NULL == m_pDB.get()) return -1;
if (NULL == m_pDS.get()) return -1;
CStdString sql = PrepareSQL("insert into addon (id, type, name, summary,"
"description, stars, path, icon, changelog, "
"fanart, addonID, version, author, disclaimer)"
" values(NULL, '%s', '%s', '%s', '%s', %i,"
"'%s', '%s', '%s', '%s', '%s','%s','%s','%s')",
TranslateType(addon->Type(),false).c_str(),
addon->Name().c_str(), addon->Summary().c_str(),
addon->Description().c_str(),addon->Stars(),
addon->Path().c_str(), addon->Props().icon.c_str(),
addon->ChangeLog().c_str(),addon->FanArt().c_str(),
addon->ID().c_str(), addon->Version().str.c_str(),
addon->Author().c_str(),addon->Disclaimer().c_str());
m_pDS->exec(sql.c_str());
int idAddon = (int)m_pDS->lastinsertid();
sql = PrepareSQL("insert into addonlinkrepo (idRepo, idAddon) values (%i,%i)",idRepo,idAddon);
m_pDS->exec(sql.c_str());
const InfoMap &info = addon->ExtraInfo();
for (InfoMap::const_iterator i = info.begin(); i != info.end(); ++i)
{
sql = PrepareSQL("insert into addonextra(id, key, value) values (%i, '%s', '%s')", idAddon, i->first.c_str(), i->second.c_str());
m_pDS->exec(sql.c_str());
}
return idAddon;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon '%s'", __FUNCTION__, addon->Name().c_str());
}
return -1;
}
示例3: Serialize
static CVariant Serialize(const AddonPtr& addon)
{
CVariant variant;
variant["addonid"] = addon->ID();
variant["type"] = CAddonInfo::TranslateType(addon->Type(), false);
variant["name"] = addon->Name();
variant["version"] = addon->Version().asString();
variant["summary"] = addon->Summary();
variant["description"] = addon->Description();
variant["path"] = addon->Path();
variant["author"] = addon->Author();
variant["thumbnail"] = addon->Icon();
variant["disclaimer"] = addon->Disclaimer();
variant["fanart"] = addon->FanArt();
variant["dependencies"] = CVariant(CVariant::VariantTypeArray);
for (const auto& dep : addon->GetDependencies())
{
CVariant info(CVariant::VariantTypeObject);
info["addonid"] = dep.id;
info["version"] = dep.requiredVersion.asString();
info["optional"] = dep.optional;
variant["dependencies"].push_back(std::move(info));
}
if (addon->Broken().empty())
variant["broken"] = false;
else
variant["broken"] = addon->Broken();
variant["extrainfo"] = CVariant(CVariant::VariantTypeArray);
for (const auto& kv : addon->ExtraInfo())
{
CVariant info(CVariant::VariantTypeObject);
info["key"] = kv.first;
info["value"] = kv.second;
variant["extrainfo"].push_back(std::move(info));
}
variant["rating"] = -1;
return variant;
}
示例4: 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;
}