2 * Copyright (C) 2005-2008 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "MusicArtistInfo.h"
23 #include "ScraperParser.h"
24 #include "addons/Scraper.h"
27 #include "CharsetConverter.h"
30 using namespace MUSIC_GRABBER
;
31 using namespace XFILE
;
34 CMusicArtistInfo::CMusicArtistInfo(void)
39 CMusicArtistInfo::~CMusicArtistInfo(void)
43 CMusicArtistInfo::CMusicArtistInfo(const CStdString
& strArtist
, const CScraperUrl
& strArtistURL
)
45 m_artist
.strArtist
= strArtist
;
46 m_artistURL
= strArtistURL
;
50 const CArtist
& CMusicArtistInfo::GetArtist() const
55 CArtist
& CMusicArtistInfo::GetArtist()
60 void CMusicArtistInfo::SetArtist(const CArtist
& artist
)
66 const CScraperUrl
& CMusicArtistInfo::GetArtistURL() const
71 bool CMusicArtistInfo::Parse(const TiXmlElement
* artist
, bool bChained
)
73 if (!m_artist
.Load(artist
,bChained
))
81 bool CMusicArtistInfo::Load(CFileCurl
& http
, const ADDON::ScraperPtr
& scraper
)
83 // load our scraper xml
87 vector
<CStdString
> extras
;
88 extras
.push_back(m_strSearch
);
90 vector
<CStdString
> xml
= scraper
->Run("GetArtistDetails",GetArtistURL(),http
,&extras
);
93 for (vector
<CStdString
>::iterator it
= xml
.begin();
94 it
!= xml
.end(); ++it
)
96 // ok, now parse the xml file
98 doc
.Parse(it
->c_str(),0,TIXML_ENCODING_UTF8
);
99 if (!doc
.RootElement())
101 CLog::Log(LOGERROR
, "%s: Unable to parse xml",__FUNCTION__
);
105 ret
= Parse(doc
.RootElement(),it
!=xml
.begin());
111 void CMusicArtistInfo::SetLoaded(bool bOnOff
)
116 bool CMusicArtistInfo::Loaded() const