本文整理汇总了C++中AddonPtr::ID方法的典型用法代码示例。如果您正苦于以下问题:C++ AddonPtr::ID方法的具体用法?C++ AddonPtr::ID怎么用?C++ AddonPtr::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddonPtr
的用法示例。
在下文中一共展示了AddonPtr::ID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckDependencies
bool CAddonInstaller::CheckDependencies(const AddonPtr &addon, CAddonDatabase *database /* = NULL */)
{
std::vector<std::string> preDeps;
preDeps.push_back(addon->ID());
CAddonDatabase localDB;
if (!database)
database = &localDB;
return CheckDependencies(addon, preDeps, *database);
}
示例2: IsConnectedClient
bool CPVRClients::IsConnectedClient(const AddonPtr addon)
{
CSingleLock lock(m_critSection);
for (PVR_CLIENTMAP_CITR itr = m_clientMap.begin(); itr != m_clientMap.end(); itr++)
if (itr->second->ID() == addon->ID())
return itr->second->ReadyToUse();
return false;
}
示例3: IsCreatedClient
bool CPVRClients::IsCreatedClient(const AddonPtr addon)
{
CSingleLock lock(m_critSection);
for (const auto &client : m_clientMap)
if (client.second->ID() == addon->ID())
return client.second->ReadyToUse();
return false;
}
示例4: RegisterAudioDSPAddon
int CActiveAEDSP::RegisterAudioDSPAddon(AddonPtr addon, bool* newRegistration/*=NULL*/)
{
int iAddonId(-1);
if (newRegistration)
*newRegistration = false;
if (!addon->Enabled())
return -1;
CLog::Log(LOGDEBUG, "ActiveAE DSP - %s - registering add-on '%s'", __FUNCTION__, addon->Name().c_str());
if (!m_databaseDSP.IsOpen())
{
CLog::Log(LOGERROR, "ActiveAE DSP - %s - failed to get the database", __FUNCTION__);
return -1;
}
/* check whether we already know this dsp addon */
iAddonId = m_databaseDSP.GetAudioDSPAddonId(addon->ID());
/* try to register the new dsp addon in the db */
if (iAddonId < 0)
{
if ((iAddonId = m_databaseDSP.Persist(addon)) < 0)
{
CLog::Log(LOGERROR, "ActiveAE DSP - %s - can't add dsp addon '%s' to the database", __FUNCTION__, addon->Name().c_str());
return -1;
}
else if (newRegistration)
*newRegistration = true;
}
AE_DSP_ADDON dspAddon;
/* load and initialise the dsp addon libraries */
{
CSingleLock lock(m_critSection);
AE_DSP_ADDONMAP_CITR existingAddon = m_addonMap.find(iAddonId);
if (existingAddon != m_addonMap.end())
{
/* return existing addon */
dspAddon = existingAddon->second;
}
else
{
/* create a new addon instance */
dspAddon = std::dynamic_pointer_cast<CActiveAEDSPAddon> (addon);
m_addonMap.insert(std::make_pair(iAddonId, dspAddon));
}
}
if (iAddonId < 0)
CLog::Log(LOGERROR, "ActiveAE DSP - %s - can't register dsp add-on '%s'", __FUNCTION__, addon->Name().c_str());
return iAddonId;
}
示例5:
CAddonInstallJob::CAddonInstallJob(const AddonPtr &addon, const AddonPtr &repo,
const std::string &hash, bool isAutoUpdate)
: m_addon(addon),
m_repo(repo),
m_hash(hash),
m_isAutoUpdate(isAutoUpdate)
{
AddonPtr dummy;
m_isUpdate = CAddonMgr::GetInstance().GetAddon(addon->ID(), dummy, ADDON_UNKNOWN, false);
}
示例6: Persist
int CActiveAEDSPDatabase::Persist(const AddonPtr addon)
{
int iReturn(-1);
/* invalid addon uid or name */
if (addon->Name().empty() || addon->ID().empty())
{
CLog::Log(LOGERROR, "Audio DSP - %s - invalid add-on uid or name", __FUNCTION__);
return iReturn;
}
string strQuery = PrepareSQL("REPLACE INTO addons (sName, sUid) VALUES ('%s', '%s');",
addon->Name().c_str(), addon->ID().c_str());
if (ExecuteQuery(strQuery))
iReturn = (int) m_pDS->lastinsertid();
return iReturn;
}
示例7: GetClientId
int CPVRClients::GetClientId(const AddonPtr client) const
{
CSingleLock lock(m_critSection);
for (PVR_CLIENTMAP_CITR itr = m_clientMap.begin(); itr != m_clientMap.end(); itr++)
if (itr->second->ID() == client->ID())
return itr->first;
return -1;
}
示例8: OnPreInstall
void OnPreInstall(const AddonPtr& addon)
{
//Before installing we need to stop/unregister any local addon
//that have this id, regardless of what the 'new' addon is.
AddonPtr localAddon;
if (CAddonMgr::GetInstance().ServicesHasStarted())
{
if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_SERVICE))
std::static_pointer_cast<CService>(localAddon)->Stop();
}
if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_CONTEXT_ITEM))
CContextMenuManager::GetInstance().Unload(*std::static_pointer_cast<CContextMenuAddon>(localAddon));
//Fallback to the pre-install callback in the addon.
//! @bug If primary extension point have changed we're calling the wrong method.
addon->OnPreInstall();
}
示例9: Persist
int CPVRDatabase::Persist(const AddonPtr client)
{
int iReturn(-1);
/* invalid client uid or name */
if (client->Name().empty() || client->ID().empty())
{
CLog::Log(LOGERROR, "PVR - %s - invalid client uid or name", __FUNCTION__);
return iReturn;
}
CStdString strQuery = PrepareSQL("REPLACE INTO clients (sName, sUid) VALUES ('%s', '%s');",
client->Name().c_str(), client->ID().c_str());
if (ExecuteQuery(strQuery))
iReturn = (int) m_pDS->lastinsertid();
return iReturn;
}
示例10: IsKnownClient
bool CPVRClients::IsKnownClient(const AddonPtr client) const
{
CSingleLock lock(m_critSection);
for (CLIENTMAPCITR itr = m_clientMap.begin(); itr != m_clientMap.end(); itr++)
if (itr->second->ID() == client->ID())
return true;
return false;
}
示例11: GetRepoForAddon
AddonPtr CAddonInstallJob::GetRepoForAddon(const AddonPtr& addon)
{
CAddonDatabase database;
database.Open();
CStdString repo;
database.GetRepoForAddon(addon->ID(), repo);
AddonPtr repoPtr;
CAddonMgr::Get().GetAddon(repo, repoPtr);
return repoPtr;
}
示例12: Install
bool CAddonInstallJob::Install(const CStdString &installFrom)
{
CStdString addonFolder(installFrom);
URIUtils::RemoveSlashAtEnd(addonFolder);
addonFolder = URIUtils::AddFileToFolder("special://home/addons/",
URIUtils::GetFileName(addonFolder));
CFileItemList install;
install.Add(CFileItemPtr(new CFileItem(installFrom, true)));
install[0]->Select(true);
CFileOperationJob job(CFileOperationJob::ActionReplace, install, "special://home/addons/");
AddonPtr addon;
if (!job.DoWork() || !CAddonMgr::Get().LoadAddonDescription(addonFolder, addon))
{ // failed extraction or failed to load addon description
CStdString addonID = URIUtils::GetFileName(addonFolder);
ReportInstallError(addonID, addonID);
CLog::Log(LOGERROR,"Could not read addon description of %s", addonID.c_str());
DeleteAddon(addonFolder);
return false;
}
// resolve dependencies
CAddonMgr::Get().FindAddons(); // needed as GetDeps() grabs directly from c-pluff via the addon manager
ADDONDEPS deps = addon->GetDeps();
CStdString referer;
referer.Format("Referer=%s-%s.zip",addon->ID().c_str(),addon->Version().c_str());
for (ADDONDEPS::iterator it = deps.begin(); it != deps.end(); ++it)
{
if (it->first.Equals("xbmc.metadata"))
continue;
AddonPtr dependency;
if (!CAddonMgr::Get().GetAddon(it->first,dependency) || dependency->Version() < it->second.first)
{
bool force=(dependency != NULL);
// dependency is already queued up for install - ::Install will fail
// instead we wait until the Job has finished. note that we
// recall install on purpose in case prior installation failed
if (CAddonInstaller::Get().HasJob(it->first))
{
while (CAddonInstaller::Get().HasJob(it->first))
Sleep(50);
force = false;
}
// don't have the addon or the addon isn't new enough - grab it (no new job for these)
if (!CAddonInstaller::Get().Install(it->first, force, referer, false))
{
DeleteAddon(addonFolder);
return false;
}
}
}
return true;
}
示例13: RegisterClient
int CPVRClients::RegisterClient(AddonPtr client, bool* newRegistration/*=NULL*/)
{
int iClientId(-1);
if (newRegistration)
*newRegistration = false;
if (!client->Enabled())
return -1;
CLog::Log(LOGDEBUG, "%s - registering add-on '%s'", __FUNCTION__, client->Name().c_str());
CPVRDatabase *database = GetPVRDatabase();
if (!database)
return -1;
// check whether we already know this client
iClientId = database->GetClientId(client->ID());
// try to register the new client in the db
if (iClientId < 0)
{
if ((iClientId = database->Persist(client)) < 0)
{
CLog::Log(LOGERROR, "PVR - %s - can't add client '%s' to the database", __FUNCTION__, client->Name().c_str());
return -1;
}
else if (newRegistration)
*newRegistration = true;
}
PVR_CLIENT addon;
// load and initialise the client libraries
{
CSingleLock lock(m_critSection);
PVR_CLIENTMAP_CITR existingClient = m_clientMap.find(iClientId);
if (existingClient != m_clientMap.end())
{
// return existing client
addon = existingClient->second;
}
else
{
// create a new client instance
addon = boost::dynamic_pointer_cast<CPVRClient>(client);
m_clientMap.insert(std::make_pair(iClientId, addon));
}
}
if (iClientId < 0)
CLog::Log(LOGERROR, "PVR - %s - can't register add-on '%s'", __FUNCTION__, client->Name().c_str());
return iClientId;
}
示例14: IsReadyAudioDSPAddon
bool CActiveAEDSP::IsReadyAudioDSPAddon(const AddonPtr &addon)
{
CSingleLock lock(m_critUpdateSection);
for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
{
if (citr->second->ID() == addon->ID())
return citr->second->ReadyToUse();
}
return false;
}
示例15: Start
void CServiceAddonManager::Start(const AddonPtr& addon)
{
CSingleLock lock(m_criticalSection);
if (m_services.find(addon->ID()) != m_services.end())
{
CLog::Log(LOGDEBUG, "CServiceAddonManager: %s already started.", addon->ID().c_str());
return;
}
if (StringUtils::EndsWith(addon->LibPath(), ".py"))
{
CLog::Log(LOGDEBUG, "CServiceAddonManager: starting %s", addon->ID().c_str());
auto handle = CScriptInvocationManager::GetInstance().ExecuteAsync(addon->LibPath(), addon);
if (handle == -1)
{
CLog::Log(LOGERROR, "CServiceAddonManager: %s failed to start", addon->ID().c_str());
return;
}
m_services[addon->ID()] = handle;
}
}