diff options
-rw-r--r-- | xbmc/FileSystem/FactoryDirectory.cpp | 2 | ||||
-rw-r--r-- | xbmc/FileSystem/Makefile.in | 1 | ||||
-rw-r--r-- | xbmc/FileSystem/ShoutcastDirectory.cpp | 258 | ||||
-rw-r--r-- | xbmc/FileSystem/ShoutcastDirectory.h | 46 | ||||
-rw-r--r-- | xbmc/GUIDialogMediaSource.cpp | 5 | ||||
-rw-r--r-- | xbmc/GUIViewState.cpp | 3 | ||||
-rw-r--r-- | xbmc/GUIViewStateMusic.cpp | 39 | ||||
-rw-r--r-- | xbmc/GUIViewStateMusic.h | 11 | ||||
-rw-r--r-- | xbmc/Settings.cpp | 2 | ||||
-rw-r--r-- | xbmc/Settings.h | 1 |
10 files changed, 1 insertions, 367 deletions
diff --git a/xbmc/FileSystem/FactoryDirectory.cpp b/xbmc/FileSystem/FactoryDirectory.cpp index 09ffb2e186..f14f862628 100644 --- a/xbmc/FileSystem/FactoryDirectory.cpp +++ b/xbmc/FileSystem/FactoryDirectory.cpp @@ -35,7 +35,6 @@ #include "MusicSearchDirectory.h" #include "VideoDatabaseDirectory.h" #include "AddonsDirectory.h" -#include "ShoutcastDirectory.h" #include "LastFMDirectory.h" #include "FTPDirectory.h" #include "HTTPDirectory.h" @@ -144,7 +143,6 @@ IDirectory* CFactoryDirectory::Create(const CStdString& strPath) if( g_application.getNetwork().IsAvailable(true) ) // true to wait for the network (if possible) { - if (strProtocol == "shout") return new CShoutcastDirectory(); if (strProtocol == "lastfm") return new CLastFMDirectory(); if (strProtocol == "tuxbox") return new CDirectoryTuxBox(); if (strProtocol == "ftp" || strProtocol == "ftpx" || strProtocol == "ftps") return new CFTPDirectory(); diff --git a/xbmc/FileSystem/Makefile.in b/xbmc/FileSystem/Makefile.in index ffb26404f6..1eb7c0dd43 100644 --- a/xbmc/FileSystem/Makefile.in +++ b/xbmc/FileSystem/Makefile.in @@ -72,7 +72,6 @@ SRCS=AddonsDirectory.cpp \ RTVDirectory.cpp \ SAPDirectory.cpp \ SAPFile.cpp \ - ShoutcastDirectory.cpp \ ShoutcastRipFile.cpp \ SIDFileDirectory.cpp \ SmartPlaylistDirectory.cpp \ diff --git a/xbmc/FileSystem/ShoutcastDirectory.cpp b/xbmc/FileSystem/ShoutcastDirectory.cpp deleted file mode 100644 index 05782c37aa..0000000000 --- a/xbmc/FileSystem/ShoutcastDirectory.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "ShoutcastDirectory.h" -#include "Util.h" -#include "FileCurl.h" -#include "utils/HttpHeader.h" -#include "VideoInfoTag.h" -#include "MusicInfoTag.h" -#include "GUIWindowManager.h" -#include "GUIDialogProgress.h" -#include "URL.h" -#include "FileItem.h" -#include "tinyXML/tinyxml.h" -#include "utils/log.h" - -using namespace XFILE; - -CShoutcastDirectory::CShoutcastDirectory(void) -{ -} - -CShoutcastDirectory::~CShoutcastDirectory(void) -{ -} - -bool CShoutcastDirectory::ParseGenres(TiXmlElement *root, CFileItemList &items, CURL &url) -{ - TiXmlElement *element = root->FirstChildElement("genre"); - - if(element == NULL) - { - CLog::Log(LOGWARNING, "%s - No genres found", __FUNCTION__); - return false; - } - - items.m_idepth = 1; /* genre list */ - - CStdString genre, path; - while(element != NULL) - { - genre = element->Attribute("name"); - path = genre; - - /* genre must be urlencoded */ - CUtil::URLEncode(path); - - url.SetOptions("?genre=" + path); - - CFileItemPtr pItem(new CFileItem); - pItem->m_bIsFolder = true; - pItem->SetLabel(genre); - pItem->GetMusicInfoTag()->SetGenre(genre); - pItem->m_strPath = url.Get(); - - items.Add(pItem); - - element = element->NextSiblingElement("genre"); - } - - return true; -} - -bool CShoutcastDirectory::ParseStations(TiXmlElement *root, CFileItemList &items, CURL &url) -{ - TiXmlElement *element = NULL; - CStdString path; - - items.m_idepth = 2; /* station list */ - - element = root->FirstChildElement("tunein"); - if(element == NULL) - { - CLog::Log(LOGWARNING, "%s - No tunein base found", __FUNCTION__); - return false; - } - - path = element->Attribute("base"); - path.TrimLeft("/"); - - url.SetFileName(path); - - element = root->FirstChildElement("station"); - - if(element == NULL) - { - CLog::Log(LOGWARNING, "%s - No stations found", __FUNCTION__); - return false; - } - int stations = 0; - while(element != NULL && stations < 1000) - { - CStdString name = element->Attribute("name"); - CStdString id = element->Attribute("id"); - CStdString bitrate = element->Attribute("br"); - CStdString genre = element->Attribute("genre"); - CStdString listeners = element->Attribute("lc"); - CStdString content = element->Attribute("mt"); - - CStdString label = name; - - url.SetOptions("?id=" + id); - - CFileItemPtr pItem(new CFileItem); - pItem->m_bIsFolder = false; - - /* we highjack the music tag for this stuff, they will be used by */ - /* viewstates to sort and display proper information */ - pItem->GetMusicInfoTag()->SetArtist(listeners); - pItem->GetMusicInfoTag()->SetAlbum(bitrate); - pItem->GetMusicInfoTag()->SetGenre(genre); - - /* this is what will be sorted upon */ - pItem->GetVideoInfoTag()->m_fRating = (float)atoi(listeners.c_str()); - pItem->m_dwSize = atoi(bitrate.c_str()); - - - pItem->SetLabel(label); - - /* mime-type is known before hand, should save later lookup */ - /* wonder if we could combine the mime-type of the playlist and of the real stream */ - pItem->SetMimeType("audio/x-scpls"); - - pItem->m_strPath = url.Get(); - - items.Add(pItem); - - stations++; - element = element->NextSiblingElement("station"); - } - - return true; -} - -bool CShoutcastDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items) -{ - CStdString strRoot = strPath; - CUtil::RemoveSlashAtEnd(strRoot); - - /* keep backward competability (for users who already have this source defined) */ - if( strRoot.Equals("shout://www.shoutcast.com") || strRoot.Equals("shout://") || strRoot.Equals("shout://classic.shoutcast.com") || - strRoot.Equals("shout://www.shoutcast.com/sbin/newxml.phtml") ) - strRoot = SHOUTCAST_MASTER_LINK; - - CGUIDialogProgress* dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); - if (dlgProgress) - { - dlgProgress->ShowProgressBar(false); - dlgProgress->SetHeading(260); - dlgProgress->SetLine(0, 14003); - dlgProgress->SetLine(1, ""); - dlgProgress->SetLine(2, ""); - dlgProgress->StartModal(); - } - - CURL url(strRoot); - CStdString protocol = url.GetProtocol(); - url.SetProtocol("http"); - - CFileCurl http; - - //CURL doesn't seem to understand that data is encoded.. odd - // opening as text for now - //http.SetContentEncoding("deflate"); - - if( !http.Open(url) ) - { - CLog::Log(LOGERROR, "%s - Unable to get shoutcast dir", __FUNCTION__); - if (dlgProgress) dlgProgress->Close(); - return false; - } - - /* restore protocol */ - url.SetProtocol(protocol); - - CStdString mime = http.GetMimeType(); - if( !(mime.Equals("text/html") || mime.Equals("text/xml") - || mime.Equals("text/html;charset=utf-8") || mime.Equals("text/xml;charset=utf-8") )) - { - CLog::Log(LOGERROR, "%s - Invalid mime-type %s", __FUNCTION__, mime.c_str()); - if (dlgProgress) dlgProgress->Close(); - return false; - } - - - int size_read = 0; - int size_total = (int)http.GetLength(); - int data_size = 0; - - CStdString data; - data.reserve(size_total); - - /* read response from server into string buffer */ - char buffer[16384]; - while( (size_read = http.Read(buffer, sizeof(buffer)-1)) > 0 ) - { - buffer[size_read] = 0; - data += buffer; - data_size += size_read; - - dlgProgress->Progress(); - - if (dlgProgress->IsCanceled()) - { - dlgProgress->Close(); - return false; - } - } - - /* parse returned xml */ - TiXmlDocument doc; - doc.Parse(data.c_str()); - - TiXmlElement *root = doc.RootElement(); - if(root == NULL) - { - CLog::Log(LOGERROR, "%s - Unable to parse xml", __FUNCTION__); - CLog::Log(LOGDEBUG, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str()); - - dlgProgress->Close(); - return false; - } - - /* clear data to keep memusage down, not needed anymore */ - data.Empty(); - - bool result = false; - if( strcmp(root->Value(), "genrelist") == 0 ) - result = ParseGenres(root, items, url); - else if( strcmp(root->Value(), "stationlist") == 0 ) - result = ParseStations(root, items, url); - else - { - CLog::Log(LOGERROR, "%s - Invalid root xml element for shoutcast",__FUNCTION__); - CLog::Log(LOGDEBUG, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str()); - } - - if (dlgProgress) dlgProgress->Close(); - return result; -} diff --git a/xbmc/FileSystem/ShoutcastDirectory.h b/xbmc/FileSystem/ShoutcastDirectory.h deleted file mode 100644 index 2ecac8ca18..0000000000 --- a/xbmc/FileSystem/ShoutcastDirectory.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "IDirectory.h" - -class CURL; -class TiXmlElement; - -#define SHOUTCAST_MASTER_LINK "shout://classic.shoutcast.com/sbin/newxml.phtml" - -namespace XFILE -{ -class CShoutcastDirectory : - public IDirectory -{ -public: - CShoutcastDirectory(void); - virtual ~CShoutcastDirectory(void); - virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items); - virtual bool IsAllowed(const CStdString &strFile) const { return true; }; - virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const { return DIR_CACHE_ALWAYS; }; - bool ParseGenres(TiXmlElement *root, CFileItemList &items, CURL &url); - bool ParseStations(TiXmlElement *root, CFileItemList &items, CURL &url); -protected: -}; - -} diff --git a/xbmc/GUIDialogMediaSource.cpp b/xbmc/GUIDialogMediaSource.cpp index cf99a074a6..02de0e70dd 100644 --- a/xbmc/GUIDialogMediaSource.cpp +++ b/xbmc/GUIDialogMediaSource.cpp @@ -29,7 +29,6 @@ #include "FileSystem/PluginDirectory.h" #include "GUIDialogYesNo.h" #include "FileSystem/File.h" -#include "FileSystem/ShoutcastDirectory.h" #include "FileItem.h" #include "Settings.h" #include "GUISettings.h" @@ -268,10 +267,6 @@ void CGUIDialogMediaSource::OnPathBrowse(int item) extraShares.push_back(share1); } - share1.strName = "Shoutcast"; - share1.strPath = SHOUTCAST_MASTER_LINK; - extraShares.push_back(share1); - if (g_guiSettings.GetString("scrobbler.lastfmusername") != "") { share1.strName = "Last.FM"; diff --git a/xbmc/GUIViewState.cpp b/xbmc/GUIViewState.cpp index 1f730f0dbb..de91d85c62 100644 --- a/xbmc/GUIViewState.cpp +++ b/xbmc/GUIViewState.cpp @@ -83,9 +83,6 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it if (items.IsPlayList()) return new CGUIViewStateMusicPlaylist(items); - if (url.GetProtocol() == "shout") - return new CGUIViewStateMusicShoutcast(items); - if (url.GetProtocol() == "lastfm") return new CGUIViewStateMusicLastFM(items); diff --git a/xbmc/GUIViewStateMusic.cpp b/xbmc/GUIViewStateMusic.cpp index da238c8945..947a00b3f7 100644 --- a/xbmc/GUIViewStateMusic.cpp +++ b/xbmc/GUIViewStateMusic.cpp @@ -35,7 +35,6 @@ #include "FileSystem/Directory.h" #include "FileSystem/MusicDatabaseDirectory.h" #include "FileSystem/VideoDatabaseDirectory.h" -#include "FileSystem/ShoutcastDirectory.h" using namespace XFILE; using namespace MUSICDATABASEDIRECTORY; @@ -519,9 +518,7 @@ void CGUIViewStateWindowMusicNav::AddOnlineShares() for (int i = 0; i < (int)g_settings.m_musicSources.size(); ++i) { CMediaSource share = g_settings.m_musicSources.at(i); - if (share.strPath.Find(SHOUTCAST_MASTER_LINK) == 0)//shoutcast shares - m_sources.push_back(share); - else if (share.strPath.Find("lastfm://") == 0)//lastfm share + if (share.strPath.Find("lastfm://") == 0)//lastfm share m_sources.push_back(share); } } @@ -675,40 +672,6 @@ VECSOURCES& CGUIViewStateWindowMusicPlaylist::GetSources() return m_sources; } -CGUIViewStateMusicShoutcast::CGUIViewStateMusicShoutcast(const CFileItemList& items) : CGUIViewStateWindowMusic(items) -{ - /* sadly m_idepth isn't remembered when a directory is retrieved from cache */ - /* and thus this check hardly ever works, so let's just disable it for now */ - if( true || m_items.m_idepth > 1 ) - { /* station list */ - AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%K", "%B kbps", "%K", "")); // Title, Bitrate | Title, nothing - AddSortMethod(SORT_METHOD_VIDEO_RATING, 563, LABEL_MASKS("%K", "%A listeners", "%K", "")); // Titel, Listeners | Titel, nothing - AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%K", "%B kbps", "%K", "")); // Title, Bitrate | Title, nothing - - SetSortMethod(g_settings.m_viewStateMusicShoutcast.m_sortMethod); - SetSortOrder(g_settings.m_viewStateMusicShoutcast.m_sortOrder); - } - else - { /* genre list */ - AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%K", "", "%K", "")); // Title, nothing | Title, nothing - SetSortMethod(SORT_METHOD_LABEL); - SetSortOrder(SORT_ORDER_ASC); /* maybe we should have this stored somewhere */ - } - - SetViewAsControl(DEFAULT_VIEW_LIST); - LoadViewState(items.m_strPath, WINDOW_MUSIC_FILES); -} - -bool CGUIViewStateMusicShoutcast::AutoPlayNextItem() -{ - return false; -} - -void CGUIViewStateMusicShoutcast::SaveViewState() -{ - SaveViewToDb(m_items.m_strPath, WINDOW_MUSIC_FILES, &g_settings.m_viewStateMusicShoutcast); -} - CGUIViewStateMusicLastFM::CGUIViewStateMusicLastFM(const CFileItemList& items) : CGUIViewStateWindowMusic(items) { CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat"); diff --git a/xbmc/GUIViewStateMusic.h b/xbmc/GUIViewStateMusic.h index b9023108bd..a1c4be916c 100644 --- a/xbmc/GUIViewStateMusic.h +++ b/xbmc/GUIViewStateMusic.h @@ -107,17 +107,6 @@ protected: virtual VECSOURCES& GetSources(); }; -class CGUIViewStateMusicShoutcast : public CGUIViewStateWindowMusic -{ -public: - CGUIViewStateMusicShoutcast(const CFileItemList& items); - -protected: - virtual bool AutoPlayNextItem(); - virtual void SaveViewState(); -}; - - class CGUIViewStateMusicLastFM : public CGUIViewStateWindowMusic { public: diff --git a/xbmc/Settings.cpp b/xbmc/Settings.cpp index a81fd8bf5e..2982f3ecb8 100644 --- a/xbmc/Settings.cpp +++ b/xbmc/Settings.cpp @@ -661,7 +661,6 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile) GetViewState(pElement, "musicnavartists", m_viewStateMusicNavArtists); GetViewState(pElement, "musicnavalbums", m_viewStateMusicNavAlbums); GetViewState(pElement, "musicnavsongs", m_viewStateMusicNavSongs); - GetViewState(pElement, "musicshoutcast", m_viewStateMusicShoutcast); GetViewState(pElement, "musiclastfm", m_viewStateMusicLastFM); GetViewState(pElement, "videonavactors", m_viewStateVideoNavActors); GetViewState(pElement, "videonavyears", m_viewStateVideoNavYears); @@ -832,7 +831,6 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo SetViewState(pNode, "musicnavartists", m_viewStateMusicNavArtists); SetViewState(pNode, "musicnavalbums", m_viewStateMusicNavAlbums); SetViewState(pNode, "musicnavsongs", m_viewStateMusicNavSongs); - SetViewState(pNode, "musicshoutcast", m_viewStateMusicShoutcast); SetViewState(pNode, "musiclastfm", m_viewStateMusicLastFM); SetViewState(pNode, "videonavactors", m_viewStateVideoNavActors); SetViewState(pNode, "videonavyears", m_viewStateVideoNavYears); diff --git a/xbmc/Settings.h b/xbmc/Settings.h index 82d5754ebe..2319b1320b 100644 --- a/xbmc/Settings.h +++ b/xbmc/Settings.h @@ -164,7 +164,6 @@ public: CViewState m_viewStateMusicNavArtists; CViewState m_viewStateMusicNavAlbums; CViewState m_viewStateMusicNavSongs; - CViewState m_viewStateMusicShoutcast; CViewState m_viewStateMusicLastFM; CViewState m_viewStateVideoNavActors; CViewState m_viewStateVideoNavYears; |