From 005e308249eb09e1a929de457676e9637fc6dea4 Mon Sep 17 00:00:00 2001 From: spiff_ Date: Sun, 23 May 2010 22:59:14 +0000 Subject: added: separate scrapers by content type in the addon browser git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@30486 568bbfeb-2a22-0410-94d2-cc84cf5bfa90 --- xbmc/FileSystem/AddonsDirectory.cpp | 45 +++++++++++++++++++++++++++++++++++++ xbmc/URL.cpp | 3 ++- xbmc/addons/Addon.cpp | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/xbmc/FileSystem/AddonsDirectory.cpp b/xbmc/FileSystem/AddonsDirectory.cpp index 21106e1c4a..48539c0882 100644 --- a/xbmc/FileSystem/AddonsDirectory.cpp +++ b/xbmc/FileSystem/AddonsDirectory.cpp @@ -110,9 +110,54 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it { TYPE type = TranslateType(path.GetFileName()); items.SetProperty("addoncategory",TranslateType(type, true)); + items.m_strPath = strPath; + + // add content types + if (type == ADDON_SCRAPER && path.GetOptions().IsEmpty()) + { + for (int i=CONTENT_MOVIES;iSupports((CONTENT_TYPE)i)) + { + CURL url2(path); + CStdString label; + if ((CONTENT_TYPE)i == CONTENT_ALBUMS) + { + url2.SetOptions("?content=music"); + label = g_localizeStrings.Get(2); + } + else + { + url2.SetOptions("?content="+TranslateContent((CONTENT_TYPE)i)); + label = TranslateContent((CONTENT_TYPE)i,true); + } + CFileItemPtr item(new CFileItem(url2.Get(),true)); + item->SetLabel(label); + item->SetLabelPreformated(true); + items.Add(item); + break; + } + } + } + return true; + } + CONTENT_TYPE content; + if (type == ADDON_SCRAPER) + { + CStdStringArray array; + StringUtils::SplitString(path.GetOptions(),"=",array); + content = TranslateContent(array[1]); + } for (unsigned int j=0;jType() != type) addons.erase(addons.begin()+j--); + else if (type == ADDON_SCRAPER && + !addons[j]->Supports(content)) + addons.erase(addons.begin()+j--); + } } items.m_strPath = strPath; diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp index 9ae0329423..db27682bb8 100644 --- a/xbmc/URL.cpp +++ b/xbmc/URL.cpp @@ -185,7 +185,8 @@ void CURL::Parse(const CStdString& strURL1) const char* sep = NULL; CStdString strProtocol2 = GetTranslatedProtocol(); - if(m_strProtocol.Equals("rss")) + if(m_strProtocol.Equals("rss") || + m_strProtocol.Equals("addons")) sep = "?"; else if(strProtocol2.Equals("http") diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp index 78e55f1490..cd3e9d8a1f 100644 --- a/xbmc/addons/Addon.cpp +++ b/xbmc/addons/Addon.cpp @@ -85,6 +85,7 @@ const CStdString TranslateContent(const CONTENT_TYPE &type, bool pretty/*=false* const CONTENT_TYPE TranslateContent(const CStdString &string) { if (string.Equals("albums")) return CONTENT_ALBUMS; + else if (string.Equals("music")) return CONTENT_ALBUMS; else if (string.Equals("artists")) return CONTENT_ARTISTS; else if (string.Equals("movies")) return CONTENT_MOVIES; else if (string.Equals("tvshows")) return CONTENT_TVSHOWS; -- cgit v1.2.3