Skip to content
This repository

set a content_type parameter for multi-content plugins/scripts #1265

Merged
2 commits merged into from over 1 year ago

1 participant

jmarshallnz
Deleted user

The content you are editing has changed. Reload the page and try again.

plugins/scripts providing multiple contents can use this to see the context they are called under and (choose to) only provide the appropriate content.

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

added some commits August 08, 2012
cosmetics 7a988cf
added: set a content_type parameter for multi-content plugins/scripts
plugins/scripts providing multiple contents can use this to see
the context they are called under and (choose to) only provide the
appropriate content
b704b75
jmarshallnz
Owner

Looks good, but I guess this is going to (potentially) break existing plugins that provide multiple content types? Dunno how many there are currently.

Deleted user

The content you are editing has changed. Reload the page and try again.

there is a potential, but the few we have in our repo is worth the risk imo. i tried a couple and they worked fine

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

jmarshallnz
Owner

Yeah - most will be using URL options for stuff anyway, and will likely be ignoring ones they don't understand.

We should be bumping the API either way. I think frodo-pre is heading out this merge window, so seems a reasonable place to break it.

Deleted user

The content you are editing has changed. Reload the page and try again.

will do, but as there are several other potential breakers in already i'd prefer to do it separately (and tomorrowish)

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

jmarshallnz
Owner
Deleted user ghost merged commit 67ee34f into from August 08, 2012
Deleted user ghost closed this August 08, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Aug 08, 2012
cosmetics 7a988cf
added: set a content_type parameter for multi-content plugins/scripts
plugins/scripts providing multiple contents can use this to see
the context they are called under and (choose to) only provide the
appropriate content
b704b75
This page is out of date. Refresh to see the latest.
11  xbmc/addons/PluginSource.h
@@ -35,8 +35,15 @@ class CPluginSource : public CAddon
35 35
   CPluginSource(const AddonProps &props);
36 36
   virtual ~CPluginSource() {}
37 37
   virtual bool IsType(TYPE type) const;
38  
-  bool Provides(const Content& content) const {
39  
-    return content == UNKNOWN ? false : m_providedContent.count(content) > 0; }
  38
+  bool Provides(const Content& content) const
  39
+  {
  40
+    return content == UNKNOWN ? false : m_providedContent.count(content) > 0;
  41
+  }
  42
+
  43
+  bool ProvidesSeveral() const
  44
+  {
  45
+    return m_providedContent.size() > 1;
  46
+  }
40 47
 
41 48
   static Content Translate(const CStdString &content);
42 49
 private:
17  xbmc/filesystem/AddonsDirectory.cpp
@@ -295,10 +295,19 @@ bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItem
295 295
 
296 296
   for (unsigned i=0; i<addons.size(); i++)
297 297
   {
298  
-    if (addons[i]->Type() == ADDON_PLUGIN)
299  
-      items.Add(FileItemFromAddon(addons[i], "plugin://", true));
300  
-    else
301  
-      items.Add(FileItemFromAddon(addons[i], "script://", false));
  298
+    CFileItemPtr item(FileItemFromAddon(addons[i], 
  299
+                      addons[i]->Type()==ADDON_PLUGIN?"plugin://":"script://",
  300
+                      addons[i]->Type() == ADDON_PLUGIN));
  301
+    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
  302
+    if (plugin->ProvidesSeveral())
  303
+    {
  304
+      CURL url = item->GetAsUrl();
  305
+      CStdString opt;
  306
+      opt.Format("?content_type=%s",content.c_str());
  307
+      url.SetOptions(opt);
  308
+      item->SetPath(url.Get());
  309
+    }
  310
+    items.Add(item);
302 311
   }
303 312
 
304 313
   items.Add(GetMoreItem(content));
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.