本文整理汇总了C++中CAddonDatabase::GetRepository方法的典型用法代码示例。如果您正苦于以下问题:C++ CAddonDatabase::GetRepository方法的具体用法?C++ CAddonDatabase::GetRepository怎么用?C++ CAddonDatabase::GetRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAddonDatabase
的用法示例。
在下文中一共展示了CAddonDatabase::GetRepository方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetItem
bool CGUIDialogAddonInfo::SetItem(const CFileItemPtr& item)
{
*m_item = *item;
m_rollbackVersions.clear();
// grab the local addon, if it's available
m_localAddon.reset();
m_addon.reset();
if (CAddonMgr::Get().GetAddon(item->GetProperty("Addon.ID").asString(), m_localAddon)) // sets m_addon if installed regardless of enabled state
m_item->SetProperty("Addon.Enabled", "true");
else
m_item->SetProperty("Addon.Enabled", "false");
m_item->SetProperty("Addon.Installed", m_addon ? "true" : "false");
CAddonDatabase database;
database.Open();
database.GetAddon(item->GetProperty("Addon.ID").asString(),m_addon);
if (TranslateType(item->GetProperty("Addon.intType").asString()) == ADDON_REPOSITORY)
{
CAddonDatabase database;
database.Open();
VECADDONS addons;
if (m_addon)
database.GetRepository(m_addon->ID(), addons);
else if (m_localAddon) // sanity
database.GetRepository(m_localAddon->ID(), addons);
int tot=0;
for (int i = ADDON_UNKNOWN+1;i<ADDON_VIZ_LIBRARY;++i)
{
int num=0;
for (unsigned int j=0;j<addons.size();++j)
{
if (addons[j]->Type() == (TYPE)i)
++num;
}
m_item->SetProperty(CStdString("Repo.") + TranslateType((TYPE)i), num);
tot += num;
}
m_item->SetProperty("Repo.Addons", tot);
}
return true;
}
示例2: InstallFromXBMCRepo
void CAddonInstaller::InstallFromXBMCRepo(const set<CStdString> &addonIDs)
{
// first check we have the main repository updated...
AddonPtr addon;
if (CAddonMgr::Get().GetAddon("repository.xbmc.org", addon))
{
VECADDONS addons;
CAddonDatabase database;
database.Open();
if (!database.GetRepository(addon->ID(), addons))
{
RepositoryPtr repo = boost::dynamic_pointer_cast<CRepository>(addon);
addons = CRepositoryUpdateJob::GrabAddons(repo, false);
}
}
// now install the addons
for (set<CStdString>::const_iterator i = addonIDs.begin(); i != addonIDs.end(); ++i)
CAddonInstaller::Get().Install(*i);
}
示例3: GetDirectory
bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
CStdString path1(strPath);
URIUtils::RemoveSlashAtEnd(path1);
CURL path(path1);
items.ClearProperties();
items.SetContent("addons");
VECADDONS addons;
// get info from repository
bool reposAsFolders = true;
if (path.GetHostName().Equals("enabled"))
{
CAddonMgr::Get().GetAllAddons(addons, true);
items.SetProperty("reponame",g_localizeStrings.Get(24062));
items.SetLabel(g_localizeStrings.Get(24062));
}
else if (path.GetHostName().Equals("disabled"))
{ // grab all disabled addons, including disabled repositories
reposAsFolders = false;
CAddonMgr::Get().GetAllAddons(addons, false, true);
items.SetProperty("reponame",g_localizeStrings.Get(24039));
items.SetLabel(g_localizeStrings.Get(24039));
}
else if (path.GetHostName().Equals("outdated"))
{
reposAsFolders = false;
CAddonMgr::Get().GetAllOutdatedAddons(addons);
items.SetProperty("reponame",g_localizeStrings.Get(24043));
items.SetLabel(g_localizeStrings.Get(24043));
}
else if (path.GetHostName().Equals("repos"))
{
CAddonMgr::Get().GetAddons(ADDON_REPOSITORY,addons,true);
items.SetLabel(g_localizeStrings.Get(24033)); // Get Add-ons
}
else if (path.GetHostName().Equals("sources"))
{
return GetScriptsAndPlugins(path.GetFileName(), items);
}
else if (path.GetHostName().Equals("all"))
{
CAddonDatabase database;
database.Open();
database.GetAddons(addons);
items.SetProperty("reponame",g_localizeStrings.Get(24032));
items.SetLabel(g_localizeStrings.Get(24032));
}
else if (path.GetHostName().Equals("search"))
{
CStdString search(path.GetFileName());
if (search.IsEmpty() && !GetKeyboardInput(16017, search))
return false;
items.SetProperty("reponame",g_localizeStrings.Get(283));
items.SetLabel(g_localizeStrings.Get(283));
CAddonDatabase database;
database.Open();
database.Search(search, addons);
GenerateListing(path, addons, items, true);
path.SetFileName(search);
items.SetPath(path.Get());
return true;
}
else
{
reposAsFolders = false;
AddonPtr addon;
CAddonMgr::Get().GetAddon(path.GetHostName(),addon);
if (!addon)
return false;
// ensure our repos are up to date
CAddonInstaller::Get().UpdateRepos(false, true);
CAddonDatabase database;
database.Open();
database.GetRepository(addon->ID(),addons);
items.SetProperty("reponame",addon->Name());
items.SetLabel(addon->Name());
}
if (path.GetFileName().IsEmpty())
{
if (!path.GetHostName().Equals("repos"))
{
for (int i=ADDON_UNKNOWN+1;i<ADDON_VIZ_LIBRARY;++i)
{
for (unsigned int j=0;j<addons.size();++j)
{
if (addons[j]->IsType((TYPE)i))
{
CFileItemPtr item(new CFileItem(TranslateType((TYPE)i,true)));
item->SetPath(URIUtils::AddFileToFolder(strPath,TranslateType((TYPE)i,false)));
item->m_bIsFolder = true;
CStdString thumb = GetIcon((TYPE)i);
if (!thumb.IsEmpty() && g_TextureManager.HasTexture(thumb))
item->SetArt("thumb", thumb);
//.........这里部分代码省略.........