Index: xbmc.vcproj
===================================================================
--- xbmc.vcproj (revision 32865)
+++ xbmc.vcproj (working copy)
@@ -1218,6 +1218,12 @@
Name="Database"
Filter="">
+
+
+
+
"special://home/scripts/xbmc subtitles"
+ if (addonID.Left(7).Equals("script.")) {
+ CStdString scriptName = addonID.Mid(7);
+ scriptName.Replace(".", " ");
+ CStdString scriptsFolder = g_settings.GetScriptsFolder() + "/" + scriptName;
+
+ if (CDirectory::Exists(scriptsFolder.c_str())) {
+ return true;
+ }
+ }
+
+ // Default
+ return false;
+}
\ No newline at end of file
Index: xbmc/AddonDatabase.h
===================================================================
--- xbmc/AddonDatabase.h (revision 0)
+++ xbmc/AddonDatabase.h (revision 0)
@@ -0,0 +1,8 @@
+#include "utils/StdString.h"
+
+class CAddonDatabase
+{
+public:
+ /* Returns true if the specified addon is installed on the system. */
+ static bool HasAddon(const CStdString& addonID);
+};
\ No newline at end of file
Index: xbmc/GUIInfoManager.cpp
===================================================================
--- xbmc/GUIInfoManager.cpp (revision 32865)
+++ xbmc/GUIInfoManager.cpp (working copy)
@@ -85,6 +85,7 @@
#include "utils/log.h"
#include "interfaces/info/InfoBool.h"
+#include "AddonDatabase.h"
using namespace std;
using namespace XFILE;
@@ -449,6 +450,10 @@
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_GET_BOOL : SYSTEM_GET_BOOL, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
else if (strTest.Left(15).Equals("system.setting("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_SETTING : SYSTEM_SETTING, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
+ else if (strTest.Left(16).Equals("system.hasaddon(")) {
+ int addon = ConditionalStringParameter(strTest.Mid(16, strTest.GetLength() - 17));
+ return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ADDON: SYSTEM_HAS_ADDON, addon));
+ }
}
// library test conditions
else if (strTest.Left(7).Equals("library"))
@@ -2360,6 +2365,12 @@
bReturn = false;
}
break;
+ case SYSTEM_HAS_ADDON:
+ {
+ CStdString addon = m_stringParameters[info.GetData1()];
+ bReturn = CAddonDatabase::HasAddon(addon);
+ }
+ break;
case CONTROL_GROUP_HAS_FOCUS:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
Index: xbmc/GUIInfoManager.h
===================================================================
--- xbmc/GUIInfoManager.h (revision 32865)
+++ xbmc/GUIInfoManager.h (working copy)
@@ -408,6 +408,7 @@
#define SYSTEM_OPENGL_RENDERER 708
#define SYSTEM_OPENGL_VERSION 709
#define SYSTEM_SETTING 710
+#define SYSTEM_HAS_ADDON 711
#define LIBRARY_HAS_MUSIC 720
#define LIBRARY_HAS_VIDEO 721