PageRenderTime 39ms CodeModel.GetById 30ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/libtomahawk/infosystem/infoplugins/generic/echonestplugin.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 88 lines | 53 code | 18 blank | 17 comment | 0 complexity | 6907267026762901599c5757930a454c MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 4 *
 5 *   Tomahawk 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 3 of the License, or
 8 *   (at your option) any later version.
 9 *
10 *   Tomahawk 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.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef ECHONESTPLUGIN_H
20#define ECHONESTPLUGIN_H
21
22#include "infosystem/infosystem.h"
23#include "infosystem/infosystemworker.h"
24
25#include <QObject>
26
27class QNetworkReply;
28
29namespace Echonest
30{
31    class Artist;
32}
33
34namespace Tomahawk
35{
36
37namespace InfoSystem
38{
39
40class EchoNestPlugin : public InfoPlugin
41{
42    Q_OBJECT
43
44public:
45    EchoNestPlugin();
46    virtual ~EchoNestPlugin();
47
48protected slots:
49    virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
50
51    virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
52    {
53        Q_UNUSED( caller );
54        Q_UNUSED( type );
55        Q_UNUSED( data );
56    }
57
58    virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
59    {
60        Q_UNUSED( criteria );
61        Q_UNUSED( requestData );
62    }
63
64private:
65    void getSongProfile( const Tomahawk::InfoSystem::InfoRequestData &requestData, const QString &item = QString() );
66    void getArtistBiography( const Tomahawk::InfoSystem::InfoRequestData &requestData );
67    void getArtistFamiliarity( const Tomahawk::InfoSystem::InfoRequestData &requestData );
68    void getArtistHotttnesss( const Tomahawk::InfoSystem::InfoRequestData &requestData );
69    void getArtistTerms( const Tomahawk::InfoSystem::InfoRequestData &requestData );
70    void getMiscTopTerms( const Tomahawk::InfoSystem::InfoRequestData &requestData );
71
72    bool isValidArtistData( const Tomahawk::InfoSystem::InfoRequestData &requestData );
73    bool isValidTrackData( const Tomahawk::InfoSystem::InfoRequestData &requestData );
74    Echonest::Artist artistFromReply( QNetworkReply* );
75
76private slots:
77    void getArtistBiographySlot();
78    void getArtistFamiliaritySlot();
79    void getArtistHotttnesssSlot();
80    void getArtistTermsSlot();
81    void getMiscTopSlot();
82};
83
84}
85
86}
87
88#endif // ECHONESTPLUGIN_H