Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add-on content language support + browser filter support #877

Merged
2 commits merged into from

2 participants

@ghost

Since the previous PR (#829) degenerated into the never-ending geolock discussions, i separated this out.

spiff added: <language> field to xbmc.metadata extension point
allows specifying the language(s) of the content the add-on provides
373f3a6
@jmarshallnz
Owner

Looks good to me (good call splitting it off).

@ghost ghost was assigned
spiff added: option to filter out foreign language add-ons in the add-on br…
…owser.

English add-ons are always included. Setting defaults to false
5c8f8f1
@ghost ghost merged commit 8990182 into xbmc:master
@kib kib referenced this pull request in kib/skin.neon
Open

Use language filter radiobutton, new in Frodo #5

@Montellese

Is this a substring check on purpose?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 13, 2012
  1. added: <language> field to xbmc.metadata extension point

    spiff authored
    allows specifying the language(s) of the content the add-on provides
Commits on Apr 15, 2012
  1. added: option to filter out foreign language add-ons in the add-on br…

    spiff authored
    …owser.
    
    English add-ons are always included. Setting defaults to false
This page is out of date. Refresh to see the latest.
View
7 addons/skin.confluence/720p/AddonBrowser.xml
@@ -83,6 +83,13 @@
<include>ButtonCommonValues</include>
<label>25000</label>
</control>
+ <control type="radiobutton" id ="7">
+ <description>Hide foreign</description>
+ <posx>0</posx>
+ <posy>210</posy>
+ <include>ButtonCommonValues</include>
+ <label>25001</label>
+ </control>
<include>CommonNowPlaying_Controls</include>
</control>
</control>
View
1  language/English/strings.xml
@@ -2252,6 +2252,7 @@
<string id="24100">To use this feature you must download an Add-on:</string>
<string id="24101">Would you like to download this Add-on?</string>
<string id="25000">Notifications</string>
+ <string id="25001">Hide foreign</string>
<!-- strings 29800 thru 29998 reserved strings used only in the default Project Mayhem III skin and not c++ code -->
<string id="29800">Library Mode</string>
View
4 xbmc/addons/Addon.cpp
@@ -151,6 +151,10 @@ AddonProps::AddonProps(const cp_extension_t *ext)
description = CAddonMgr::Get().GetTranslatedString(metadata->configuration, "description");
disclaimer = CAddonMgr::Get().GetTranslatedString(metadata->configuration, "disclaimer");
license = CAddonMgr::Get().GetExtValue(metadata->configuration, "license");
+ CStdString language;
+ language = CAddonMgr::Get().GetExtValue(metadata->configuration, "language");
+ if (!language.IsEmpty())
+ extrainfo.insert(make_pair("language",language));
broken = CAddonMgr::Get().GetExtValue(metadata->configuration, "broken");
EMPTY_IF("nofanart",fanart)
EMPTY_IF("noicon",icon)
View
4 xbmc/addons/AddonDatabase.cpp
@@ -558,6 +558,10 @@ void CAddonDatabase::SetPropertiesFromAddon(const AddonPtr& addon,
pItem->SetProperty("Addon.StarRating",starrating);
pItem->SetProperty("Addon.Path", addon->Path());
pItem->SetProperty("Addon.Broken", addon->Props().broken);
+ std::map<CStdString,CStdString>::iterator it =
+ addon->Props().extrainfo.find("language");
+ if (it != addon->Props().extrainfo.end())
+ pItem->SetProperty("Addon.Language", it->second);
}
bool CAddonDatabase::DisableAddon(const CStdString &addonID, bool disable /* = true */)
View
46 xbmc/addons/GUIWindowAddonBrowser.cpp
@@ -48,9 +48,11 @@
#include "settings/AdvancedSettings.h"
#include "storage/MediaManager.h"
#include "settings/GUISettings.h"
+#include "LangInfo.h"
-#define CONTROL_AUTOUPDATE 5
-#define CONTROL_SHUTUP 6
+#define CONTROL_AUTOUPDATE 5
+#define CONTROL_SHUTUP 6
+#define CONTROL_FOREIGNFILTER 7
using namespace ADDON;
using namespace XFILE;
@@ -100,6 +102,13 @@ bool CGUIWindowAddonBrowser::OnMessage(CGUIMessage& message)
g_settings.Save();
return true;
}
+ else if (iControl == CONTROL_FOREIGNFILTER)
+ {
+ g_settings.m_bAddonForeignFilter = !g_settings.m_bAddonForeignFilter;
+ g_settings.Save();
+ Update(m_vecItems->GetPath());
+ return true;
+ }
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
// get selected item
@@ -246,9 +255,23 @@ void CGUIWindowAddonBrowser::UpdateButtons()
{
SET_CONTROL_SELECTED(GetID(),CONTROL_AUTOUPDATE,g_settings.m_bAddonAutoUpdate);
SET_CONTROL_SELECTED(GetID(),CONTROL_SHUTUP,g_settings.m_bAddonNotifications);
+ SET_CONTROL_SELECTED(GetID(),CONTROL_FOREIGNFILTER,g_settings.m_bAddonForeignFilter);
CGUIMediaWindow::UpdateButtons();
}
+static bool FilterVar(bool valid, const CVariant& variant,
+ const std::string& check)
+{
+ if (!valid)
+ return false;
+
+ if (variant.isNull() || variant.asString().empty())
+ return false;
+
+ std::string regions = variant.asString();
+ return regions.find(check) == std::string::npos;
+}
+
bool CGUIWindowAddonBrowser::GetDirectory(const CStdString& strDirectory,
CFileItemList& items)
{
@@ -275,7 +298,26 @@ bool CGUIWindowAddonBrowser::GetDirectory(const CStdString& strDirectory,
}
else
+ {
result = CGUIMediaWindow::GetDirectory(strDirectory,items);
+ if (g_settings.m_bAddonForeignFilter)
+ {
+ int i=0;
+ while (i < items.Size())
+ {
+ if (FilterVar(g_settings.m_bAddonForeignFilter,
+ items[i]->GetProperty("Addon.Language"), "en") ||
+ FilterVar(g_settings.m_bAddonForeignFilter,
+ items[i]->GetProperty("Addon.Language"),
+ g_langInfo.GetLanguageLocale()))
+ {
+ items.Remove(i);
+ }
+ else
+ i++;
+ }
+ }
+ }
if (strDirectory.IsEmpty() && CAddonInstaller::Get().IsDownloading())
{
View
3  xbmc/settings/Settings.cpp
@@ -93,6 +93,7 @@ void CSettings::Initialize()
m_bStartVideoWindowed = false;
m_bAddonAutoUpdate = true;
m_bAddonNotifications = true;
+ m_bAddonForeignFilter = false;
m_nVolumeLevel = 0;
m_dynamicRangeCompressionLevel = 0;
@@ -667,6 +668,7 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
GetInteger(pElement, "httpapibroadcastport", m_HttpApiBroadcastPort, 8278, 1, 65535);
XMLUtils::GetBoolean(pElement, "addonautoupdate", m_bAddonAutoUpdate);
XMLUtils::GetBoolean(pElement, "addonnotifications", m_bAddonNotifications);
+ XMLUtils::GetBoolean(pElement, "addonforeignfilter", m_bAddonForeignFilter);
}
pElement = pRootElement->FirstChildElement("defaultvideosettings");
@@ -870,6 +872,7 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo
XMLUtils::SetInt(pNode, "httpapibroadcastlevel", m_HttpApiBroadcastLevel);
XMLUtils::SetBoolean(pNode, "addonautoupdate", m_bAddonAutoUpdate);
XMLUtils::SetBoolean(pNode, "addonnotifications", m_bAddonNotifications);
+ XMLUtils::SetBoolean(pNode, "addonforeignfilter", m_bAddonForeignFilter);
// default video settings
TiXmlElement videoSettingsNode("defaultvideosettings");
View
1  xbmc/settings/Settings.h
@@ -208,6 +208,7 @@ class CSettings
bool m_bStartVideoWindowed;
bool m_bAddonAutoUpdate;
bool m_bAddonNotifications;
+ bool m_bAddonForeignFilter;
int m_iVideoStartWindow;
Something went wrong with that request. Please try again.