CStdString GetXbmcApiVersionDependency(ADDON::AddonPtr addon) { CStdString version("1.0"); if (addon.get() != NULL) { const ADDON::ADDONDEPS &deps = addon->GetDeps(); ADDON::ADDONDEPS::const_iterator it; CStdString key("xbmc.python"); it = deps.find(key); if (!(it == deps.end())) { const ADDON::AddonVersion * xbmcApiVersion = &(it->second.first); version = xbmcApiVersion->c_str(); } } return version; }
void CPythonInvoker::getAddonModuleDeps(const ADDON::AddonPtr& addon, std::set<std::string>& paths) { ADDON::ADDONDEPS deps = addon->GetDeps(); for (ADDON::ADDONDEPS::const_iterator it = deps.begin(); it != deps.end(); ++it) { //Check if dependency is a module addon ADDON::AddonPtr dependency; if (ADDON::CAddonMgr::Get().GetAddon(it->first, dependency, ADDON::ADDON_SCRIPT_MODULE)) { std::string path = CSpecialProtocol::TranslatePath(dependency->LibPath()); if (paths.find(path) == paths.end()) { // add it and its dependencies paths.insert(path); getAddonModuleDeps(dependency, paths); } } } }