Sayonara Player
LFMTrackChangedThread.h
1 /* LFMTrackChangedThread.h
2 
3  * Copyright (C) 2011-2020 Michael Lugmair (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 Michael Lugmair (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/Pimpl.h"
30 
31 #include <QObject>
32 
33 class SmartCompare;
34 
35 namespace LastFM
36 {
38  public QObject
39  {
40  Q_OBJECT
41  PIMPL(TrackChangedThread)
42 
43  signals:
44  void sigSimilarArtistsAvailable(const IdList& artistIds);
45 
46  public:
47  explicit TrackChangedThread(QObject* parent=nullptr);
49 
50  void searchSimilarArtists(const MetaData& md);
51  void updateNowPlaying(const QString& sessionKey, const MetaData& md);
52 
53  private:
54  void evaluateArtistMatch(const ArtistMatch& artistMatch);
55  QMap<QString, int> filterAvailableArtists(const ArtistMatch& artistMatch, ArtistMatch::Quality quality);
56 
57  private slots:
58  void similarArtistResponseReceived(const QByteArray& data);
59  void similarArtistsErrorReceived(const QString& error);
60 
61  void updateResponseReceived(const QByteArray& response);
62  void updateErrorReceived(const QString& error);
63  };
64 }
65 #endif /* LFMTRACKCHANGEDTHREAD_H_ */
LastFM::ArtistMatch::Quality
Quality
The Quality enum used to access the bin of interest. See ArtistMatch::get(Quality q)
Definition: ArtistMatch.h:52
QList
Definition: EngineUtils.h:33
QMap
Definition: org_mpris_media_player2_adaptor.h:21
MetaData
The MetaData class.
Definition: MetaData.h:45
LastFM::TrackChangedThread
Definition: LFMTrackChangedThread.h:37
LastFM::ArtistMatch
Definition: ArtistMatch.h:29