Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1265 from cptspiff/multi_content

set a content_type parameter for multi-content plugins/scripts
  • Loading branch information...
commit 67ee34f2370c4fa6d816a82ede4cb65aa936458c 2 parents 6f3088b + b704b75
Arne Morten Kvarving authored
Showing with 22 additions and 6 deletions.
  1. +9 −2 xbmc/addons/PluginSource.h
  2. +13 −4 xbmc/filesystem/AddonsDirectory.cpp
View
11 xbmc/addons/PluginSource.h
@@ -35,8 +35,15 @@ class CPluginSource : public CAddon
CPluginSource(const AddonProps &props);
virtual ~CPluginSource() {}
virtual bool IsType(TYPE type) const;
- bool Provides(const Content& content) const {
- return content == UNKNOWN ? false : m_providedContent.count(content) > 0; }
+ bool Provides(const Content& content) const
+ {
+ return content == UNKNOWN ? false : m_providedContent.count(content) > 0;
+ }
+
+ bool ProvidesSeveral() const
+ {
+ return m_providedContent.size() > 1;
+ }
static Content Translate(const CStdString &content);
private:
View
17 xbmc/filesystem/AddonsDirectory.cpp
@@ -295,10 +295,19 @@ bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItem
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));
+ 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));
Please sign in to comment.
Something went wrong with that request. Please try again.