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 <QMap>
29 
30 #include "ArtistMatch.h"
31 #include "Helper/typedefs.h"
32 #include "Helper/MetaData/MetaDataFwd.h"
33 #include "Helper/Pimpl.h"
34 
35 class SmartCompare;
37  public QObject
38 {
39  Q_OBJECT
40 
41 signals:
42 
43  void sig_similar_artists_available(const IDList& artist_ids);
44 
45 
46 public:
47  explicit LFMTrackChangedThread(const QString& username=QString(), const QString& session_key=QString(), QObject* parent=nullptr);
49 
50  void set_session_key(const QString& session_key);
51  void set_username(const QString& username);
52 
53  void search_similar_artists(const MetaData& md);
54  void update_now_playing(const MetaData& md);
55 
56 
57 private:
59 
60 private:
61  void evaluate_artist_match(const ArtistMatch& artist_match);
62 
63  QMap<QString, int> filter_available_artists(const ArtistMatch& artist_match, ArtistMatch::Quality quality);
64 
65 
66 private slots:
67  void response_sim_artists(const QByteArray& data);
68  void error_sim_artists(const QString& error);
69 
70  void response_update(const QByteArray& response);
71  void error_update(const QString& error);
72 };
73 
74 #endif /* LFMTRACKCHANGEDTHREAD_H_ */
The MetaData class MetaDataHelper.
Definition: MetaData.h:55
Quality
The Quality enum used to access the bin of interest. See ArtistMatch::get(Quality q) ...
Definition: ArtistMatch.h:48
Definition: ArtistMatch.h:27
The SmartCompare class.
Definition: SmartCompare.h:50
Definition: LFMTrackChangedThread.h:36
Definition: org_mpris_media_player2_adaptor.h:21