Sayonara Player
LFMTrackChangedThread.h
1 /* LFMTrackChangedThread.h
2 
3  * Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara-player
6  *
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 3 of the License, or
10  * (at your option) any later version.
11  *
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * created by Lucio Carreras,
21  * Jul 18, 2012
22  *
23  */
24 
25 #ifndef LFMTRACKCHANGEDTHREAD_H_
26 #define LFMTRACKCHANGEDTHREAD_H_
27 
28 #include "ArtistMatch.h"
29 #include "Utils/MetaData/MetaDataFwd.h"
30 #include "Utils/Pimpl.h"
31 
32 #include <QObject>
33 
34 class SmartCompare;
35 
36 namespace LastFM
37 {
39  public QObject
40  {
41  Q_OBJECT
42  PIMPL(TrackChangedThread)
43 
44  signals:
45  void sig_similar_artists_available(const IdList& artist_ids);
46 
47 
48  public:
49  explicit TrackChangedThread(const QString& username=QString(), const QString& session_key=QString(), QObject* parent=nullptr);
51 
52  void set_session_key(const QString& session_key);
53  void set_username(const QString& username);
54 
55  void search_similar_artists(const MetaData& md);
56  void update_now_playing(const MetaData& md);
57 
58 
59  private:
60  void evaluate_artist_match(const ArtistMatch& artist_match);
61 
62  QMap<QString, int> filter_available_artists(const ArtistMatch& artist_match, ArtistMatch::Quality quality);
63 
64 
65  private slots:
66  void response_sim_artists(const QByteArray& data);
67  void error_sim_artists(const QString& error);
68 
69  void response_update(const QByteArray& response);
70  void error_update(const QString& error);
71  };
72 }
73 #endif /* LFMTRACKCHANGEDTHREAD_H_ */
The MetaData class.
Definition: MetaData.h:48
The SmartCompare class.
Definition: SmartCompare.h:50
Definition: ArtistMatch.h:30
Definition: LFMTrackChangedThread.h:38
Definition: ArtistMatch.h:28
Definition: org_mpris_media_player2_adaptor.h:21
Quality
The Quality enum used to access the bin of interest. See ArtistMatch::get(Quality q) ...
Definition: ArtistMatch.h:53