예제 #1
0
void CBinaryAddonManager::InstalledChangeEvent()
{
  BINARY_ADDON_LIST binaryAddonList;
  CServiceBroker::GetAddonMgr().GetInstalledBinaryAddons(binaryAddonList);

  CSingleLock lock(m_critSection);

  BinaryAddonMgrBaseList deletedAddons = m_installedAddons;
  for (auto addon : binaryAddonList)
  {
    auto knownAddon = m_installedAddons.find(addon.second.ID());
    if (knownAddon == m_installedAddons.end())
    {
      CLog::Log(LOGDEBUG, "CBinaryAddonManager::%s: Adding new binary addon '%s'", __FUNCTION__, addon.second.ID().c_str());

      if (!AddAddonBaseEntry(addon))
        continue;
    }
    else
    {
      deletedAddons.erase(addon.second.ID());
    }
  }

  for (auto addon : deletedAddons)
  {
    CLog::Log(LOGDEBUG, "CBinaryAddonManager::%s: Removing binary addon '%s'", __FUNCTION__, addon.first.c_str());

    m_installedAddons.erase(addon.first);
    m_enabledAddons.erase(addon.first);
  }
}
예제 #2
0
void CBinaryAddonManager::InstalledChangeEvent()
{
  BINARY_ADDON_LIST binaryAddonList;
  CAddonMgr::GetInstance().GetInstalledBinaryAddons(binaryAddonList);

  CSingleLock lock(m_critSection);

  BinaryAddonMgrBaseList deletedAddons = m_installedAddons;
  for (auto addon : binaryAddonList)
  {
    auto knownAddon = m_installedAddons.find(addon.second.ID());
    if (knownAddon == m_installedAddons.end())
    {
      CLog::Log(LOGDEBUG, "CBinaryAddonManager::%s: Adding new binary addon '%s'", __FUNCTION__, addon.second.ID().c_str());

      if (!AddAddonBaseEntry(addon))
        continue;

      /**
       * @todo add way to inform type addon manager (e.g. for PVR) and parts about changed addons
       *
       * Currently only Screensaver and Visualization use the new way and not need informed.
       */
    }
    else
    {
      deletedAddons.erase(addon.second.ID());
    }
  }

  for (auto addon : deletedAddons)
  {
    CLog::Log(LOGDEBUG, "CBinaryAddonManager::%s: Removing binary addon '%s'", __FUNCTION__, addon.first.c_str());

    m_installedAddons.erase(addon.first);
    m_enabledAddons.erase(addon.first); // Normally should the addon disabled by another event, but to make sure also erased here

    /**
     * @todo add way to inform type addon manager (e.g. for PVR) and parts about changed addons
     *
     * Currently only Screensaver and Visualization use the new way and not need informed.
     */
  }
}