2018-12-23 18:54:27 +01:00
|
|
|
/*
|
|
|
|
* Strawberry Music Player
|
2021-03-20 21:14:47 +01:00
|
|
|
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
2018-12-23 18:54:27 +01:00
|
|
|
*
|
|
|
|
* Strawberry is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Strawberry is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SCROBBLERSERVICE_H
|
|
|
|
#define SCROBBLERSERVICE_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
2018-12-26 15:05:32 +01:00
|
|
|
#include <QPair>
|
|
|
|
#include <QList>
|
2018-12-23 18:54:27 +01:00
|
|
|
#include <QVariant>
|
|
|
|
#include <QByteArray>
|
2018-12-26 15:05:32 +01:00
|
|
|
#include <QString>
|
2018-12-23 18:54:27 +01:00
|
|
|
#include <QJsonObject>
|
|
|
|
|
|
|
|
class Application;
|
|
|
|
class Song;
|
|
|
|
|
|
|
|
class ScrobblerService : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ScrobblerService(const QString &name, Application *app, QObject *parent);
|
|
|
|
|
|
|
|
QString name() const { return name_; }
|
|
|
|
|
|
|
|
virtual void ReloadSettings() = 0;
|
|
|
|
|
|
|
|
virtual bool IsEnabled() const { return false; }
|
|
|
|
virtual bool IsAuthenticated() const { return false; }
|
|
|
|
|
|
|
|
virtual void UpdateNowPlaying(const Song &song) = 0;
|
2019-06-12 00:38:52 +02:00
|
|
|
virtual void ClearPlaying() = 0;
|
2018-12-23 18:54:27 +01:00
|
|
|
virtual void Scrobble(const Song &song) = 0;
|
2019-06-12 00:38:52 +02:00
|
|
|
virtual void Love() {}
|
2019-11-14 21:07:30 +01:00
|
|
|
virtual void Error(const QString &error, const QVariant &debug = QVariant()) = 0;
|
2018-12-23 18:54:27 +01:00
|
|
|
|
2022-02-16 17:46:40 +01:00
|
|
|
virtual void StartSubmit(const bool initial = false) = 0;
|
2018-12-23 18:54:27 +01:00
|
|
|
virtual void Submitted() = 0;
|
|
|
|
virtual bool IsSubmitted() const { return false; }
|
|
|
|
|
|
|
|
typedef QPair<QString, QString> Param;
|
|
|
|
typedef QPair<QByteArray, QByteArray> EncodedParam;
|
|
|
|
typedef QList<Param> ParamList;
|
|
|
|
|
2019-06-12 00:38:52 +02:00
|
|
|
QJsonObject ExtractJsonObj(const QByteArray &data, const bool ignore_empty = false);
|
2018-12-23 18:54:27 +01:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
virtual void Submit() = 0;
|
|
|
|
virtual void WriteCache() = 0;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void ErrorMessage(QString);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString name_;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SCROBBLERSERVICE_H
|