void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders) { CStdString xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc/addons"); items.ClearItems(); CAddonDatabase db; db.Open(); for (unsigned i=0; i < addons.size(); i++) { AddonPtr addon = addons[i]; CFileItemPtr pItem; if (reposAsFolders && addon->Type() == ADDON_REPOSITORY) pItem = FileItemFromAddon(addon, "addons://", true); else pItem = FileItemFromAddon(addon, path.Get(), false); AddonPtr addon2; if (CAddonMgr::Get().GetAddon(addon->ID(),addon2)) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305)); else if (db.IsOpen() && db.IsAddonDisabled(addon->ID())) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023)); if (!addon->Props().broken.IsEmpty()) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098)); if (addon2 && addon2->Version() < addon->Version()) { pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068)); pItem->SetProperty("Addon.UpdateAvail", true); } CAddonDatabase::SetPropertiesFromAddon(addon,pItem); items.Add(pItem); } db.Close(); }
void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders) { items.ClearItems(); for (unsigned i=0; i < addons.size(); i++) { AddonPtr addon = addons[i]; CFileItemPtr pItem; if (reposAsFolders && addon->Type() == ADDON_REPOSITORY) pItem = FileItemFromAddon(addon, "addons://", true); else pItem = FileItemFromAddon(addon, path.Get(), false); AddonPtr addon2; if (CAddonMgr::Get().GetAddon(addon->ID(),addon2)) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305)); else if (CAddonMgr::Get().IsAddonDisabled(addon->ID())) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023)); if (addon->Props().broken == "DEPSNOTMET") pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24049)); else if (!addon->Props().broken.empty()) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098)); if (addon2 && addon2->Version() < addon->Version()) { pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068)); pItem->SetProperty("Addon.UpdateAvail", true); } CAddonDatabase::SetPropertiesFromAddon(addon,pItem); items.Add(pItem); } }
void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders) { CStdString xbmcPath = _P("special://xbmc/addons"); items.ClearItems(); for (unsigned i=0; i < addons.size(); i++) { AddonPtr addon = addons[i]; CFileItemPtr pItem; if (reposAsFolders && addon->Type() == ADDON_REPOSITORY) pItem = FileItemFromAddon(addon, "addons://", true); else pItem = FileItemFromAddon(addon, path.Get(), false); AddonPtr addon2; if (CAddonMgr::Get().GetAddon(addon->ID(),addon2)) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305)); else if ((addon->Type() == ADDON_PVRDLL) && (CStdString(pItem->GetProperty("Addon.Path").asString()).Left(xbmcPath.size()).Equals(xbmcPath))) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023)); if (!addon->Props().broken.IsEmpty()) pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098)); if (addon2 && addon2->Version() < addon->Version()) { pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068)); pItem->SetProperty("Addon.UpdateAvail", true); } CAddonDatabase::SetPropertiesFromAddon(addon,pItem); items.Add(pItem); } }
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items) { items.Clear(); VECADDONS addons; if (!GetScriptsAndPlugins(content, addons)) return false; for (unsigned i=0; i<addons.size(); i++) { CFileItemPtr item(FileItemFromAddon(addons[i], addons[i]->Type()==ADDON_PLUGIN?"plugin://":"script://", addons[i]->Type() == ADDON_PLUGIN)); PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]); if (plugin->ProvidesSeveral()) { CURL url = item->GetAsUrl(); CStdString opt; opt.Format("?content_type=%s",content.c_str()); url.SetOptions(opt); item->SetPath(url.Get()); } items.Add(item); } items.Add(GetMoreItem(content)); items.SetContent("addons"); items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons return items.Size() > 0; }
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items) { items.Clear(); CPluginSource::Content type = CPluginSource::Translate(content); if (type == CPluginSource::UNKNOWN) return false; VECADDONS addons; CAddonMgr::Get().GetAddons(ADDON_PLUGIN, addons); for (unsigned i=0; i<addons.size(); i++) { PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]); if (!plugin || !plugin->Provides(type)) continue; items.Add(FileItemFromAddon(addons[i], "plugin://", true)); } addons.clear(); CAddonMgr::Get().GetAddons(ADDON_SCRIPT, addons); for (unsigned i=0; i<addons.size(); i++) { PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]); if (!plugin || !plugin->Provides(type)) continue; items.Add(FileItemFromAddon(addons[i], "script://", false)); } CFileItemPtr item(new CFileItem("addons://more/"+content,false)); item->SetLabelPreformated(true); item->SetLabel(g_localizeStrings.Get(21452)); item->SetIconImage("DefaultAddon.png"); item->SetSpecialSort(SORT_ON_BOTTOM); items.Add(item); items.SetContent("addons"); return items.Size() > 0; }
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items) { items.Clear(); VECADDONS addons; if (!GetScriptsAndPlugins(content, addons)) return false; for (unsigned i=0; i<addons.size(); i++) { if (addons[i]->Type() == ADDON_PLUGIN) items.Add(FileItemFromAddon(addons[i], "plugin://", true)); else items.Add(FileItemFromAddon(addons[i], "script://", false)); } items.Add(GetMoreItem(content)); items.SetContent("addons"); items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons return items.Size() > 0; }