diff options
author | spiff_ <spiff_@svn> | 2010-05-23 22:59:14 +0000 |
---|---|---|
committer | spiff_ <spiff_@svn> | 2010-05-23 22:59:14 +0000 |
commit | 005e308249eb09e1a929de457676e9637fc6dea4 (patch) | |
tree | a77e7aaa37a71dab0f539ee759fcaeba864c1f2e | |
parent | 01704aa4b16d08df840f47c26af4c2a892198e61 (diff) |
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
-rw-r--r-- | xbmc/FileSystem/AddonsDirectory.cpp | 45 | ||||
-rw-r--r-- | xbmc/URL.cpp | 3 | ||||
-rw-r--r-- | xbmc/addons/Addon.cpp | 1 |
3 files changed, 48 insertions, 1 deletions
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;i<CONTENT_ARTISTS;++i) + { + for (unsigned int j=0;j<addons.size();++j) + { + if (addons[j]->Supports((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;j<addons.size();++j) + { if (addons[j]->Type() != 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; |