changed: update version strings for beta4
[xbmc.git] / xbmc / utils / MusicInfoScraper.h
blob78891935cd6fcab341b4e9f25b5f64b5ca8b5fcd
1 #pragma once
3 /*
4 * Copyright (C) 2005-2008 Team XBMC
5 * http://www.xbmc.org
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 * http://www.gnu.org/copyleft/gpl.html
24 #include "MusicAlbumInfo.h"
25 #include "MusicArtistInfo.h"
26 #include "addons/Scraper.h"
27 #include "Thread.h"
28 #include "FileSystem/FileCurl.h"
30 namespace XFILE { class CFileCurl; }
32 namespace MUSIC_GRABBER
34 class CMusicInfoScraper : public CThread
36 public:
37 CMusicInfoScraper(const ADDON::ScraperPtr &scraper);
38 virtual ~CMusicInfoScraper(void);
39 void FindAlbuminfo(const CStdString& strAlbum, const CStdString& strArtist = "");
40 void LoadAlbuminfo(int iAlbum);
41 void FindArtistinfo(const CStdString& strArtist);
42 void LoadArtistinfo(int iArtist);
43 bool Completed();
44 bool Successfull();
45 void Cancel();
46 bool IsCanceled();
47 int GetAlbumCount() const;
48 int GetArtistCount() const;
49 CMusicAlbumInfo& GetAlbum(int iAlbum);
50 CMusicArtistInfo& GetArtist(int iArtist);
51 std::vector<CMusicArtistInfo>& GetArtists()
53 return m_vecArtists;
55 std::vector<CMusicAlbumInfo>& GetAlbums()
57 return m_vecAlbums;
59 void SetScraperInfo(const ADDON::ScraperPtr& scraper)
61 m_scraper = scraper;
63 /*!
64 \brief Checks whether we have a valid scraper. If not, we try the fallbackScraper
65 First tests the current scraper for validity by loading it. If it is not valid we
66 attempt to load the fallback scraper. If this is also invalid we return false.
67 \param fallbackScraper name of scraper to use as a fallback
68 \return true if we have a valid scraper (or the default is valid).
70 bool CheckValidOrFallback(const CStdString &fallbackScraper);
71 protected:
72 void FindAlbuminfo();
73 void LoadAlbuminfo();
74 void FindArtistinfo();
75 void LoadArtistinfo();
76 virtual void OnStartup();
77 virtual void Process();
78 std::vector<CMusicAlbumInfo> m_vecAlbums;
79 std::vector<CMusicArtistInfo> m_vecArtists;
80 CStdString m_strAlbum;
81 CStdString m_strArtist;
82 int m_iAlbum;
83 int m_iArtist;
84 bool m_bSuccessfull;
85 bool m_bCanceled;
86 XFILE::CFileCurl m_http;
87 ADDON::ScraperPtr m_scraper;