aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/GUIMediaWindow.cpp18
-rw-r--r--xbmc/GUIViewState.cpp10
-rw-r--r--xbmc/addons/AddonManager.cpp2
3 files changed, 29 insertions, 1 deletions
diff --git a/xbmc/GUIMediaWindow.cpp b/xbmc/GUIMediaWindow.cpp
index de96622106..100b4d0497 100644
--- a/xbmc/GUIMediaWindow.cpp
+++ b/xbmc/GUIMediaWindow.cpp
@@ -56,6 +56,9 @@
#include "utils/FileUtils.h"
#include "GUIEditControl.h"
#include "GUIDialogKeyboard.h"
+#ifdef HAS_PYTHON
+#include "lib/libPython/XBPython.h"
+#endif
#define CONTROL_BTNVIEWASICONS 2
#define CONTROL_BTNSORTBY 3
@@ -809,6 +812,21 @@ bool CGUIMediaWindow::OnClick(int iItem)
if (pItem->m_bIsFolder)
{
+ CURL url(pItem->m_strPath);
+ if (url.GetProtocol() == "script")
+ {
+ // execute the script
+ AddonPtr addon;
+ if (CAddonMgr::Get().GetAddon(url.GetHostName(), addon))
+ {
+#ifdef HAS_PYTHON
+ if (!g_pythonParser.StopScript(addon->LibPath()))
+ g_pythonParser.evalFile(addon->LibPath());
+#endif
+ return true;
+ }
+ }
+
if ( pItem->m_bIsShareOrDrive )
{
const CStdString& strLockType=m_guiState->GetLockType();
diff --git a/xbmc/GUIViewState.cpp b/xbmc/GUIViewState.cpp
index 9f5f771ec5..7cd506715f 100644
--- a/xbmc/GUIViewState.cpp
+++ b/xbmc/GUIViewState.cpp
@@ -370,6 +370,16 @@ VECSOURCES& CGUIViewState::GetSources()
m_sources.push_back(SourceFromPlugin(plugin, "plugin"));
}
+ addons.clear();
+ ADDON::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(m_content))
+ continue;
+ m_sources.push_back(SourceFromPlugin(plugin, "script"));
+ }
+
return m_sources;
}
diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp
index 7a5ce214fe..99e27f36d7 100644
--- a/xbmc/addons/AddonManager.cpp
+++ b/xbmc/addons/AddonManager.cpp
@@ -80,8 +80,8 @@ AddonPtr CAddonMgr::Factory(const cp_extension_t *props)
switch (type)
{
case ADDON_PLUGIN:
- return AddonPtr(new CPluginSource(props));
case ADDON_SCRIPT:
+ return AddonPtr(new CPluginSource(props));
case ADDON_SCRIPT_LIBRARY:
case ADDON_SCRIPT_LYRICS:
case ADDON_SCRIPT_WEATHER: